Compare commits

...

1 Commits

Author SHA1 Message Date
Bill Wendling
93c80e5bff Creating release_35 branch
llvm-svn: 213607
llvm-svn: 213606
llvm-svn: 213605
llvm-svn: 213604
llvm-svn: 213603
llvm-svn: 213602
llvm-svn: 213601
llvm-svn: 213598
llvm-svn: 213597
2014-07-22 03:16:41 +00:00
359 changed files with 0 additions and 69343 deletions

View File

@@ -1,19 +0,0 @@
-*- rst -*-
This is a collection of tests to check debugging information generated by
compiler. This test suite can be checked out inside clang/test folder. This
will enable 'make test' for clang to pick up these tests. Typically, test
cases included here includes debugger commands and intended debugger output
as comments in source file using DEBUGGER: and CHECK: as prefixes respectively.
For example::
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
}
is a testcase where the debugger is asked to break at function 'f1' and
print value of argument 'i'. The expected value of 'i' is 42 in this case.

View File

@@ -1,32 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %clangxx %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
// Radar 8945514
// DEBUGGER: break 22
// DEBUGGER: r
// DEBUGGER: p v
// CHECK: ${{[0-9]+}} =
// CHECK: Data ={{.*}} 0x0{{(0*)}}
// CHECK: Kind = 2142
class SVal {
public:
~SVal() {}
const void* Data;
unsigned Kind;
};
void bar(SVal &v) {}
class A {
public:
void foo(SVal v) { bar(v); }
};
int main() {
SVal v;
v.Data = 0;
v.Kind = 2142;
A a;
a.foo(v);
return 0;
}

View File

@@ -1,32 +0,0 @@
// RUN: %clang -O0 -g %s -c -o %t.o
// RUN: %clang %t.o -o %t.out -framework Foundation
// RUN: %test_debuginfo %s %t.out
// REQUIRES: system-darwin
// DEBUGGER: break 24
// DEBUGGER: r
// DEBUGGER: p result
// CHECK: ${{[0-9]}} = 42
void doBlock(void (^block)(void))
{
block();
}
int I(int n)
{
__block int result;
int i = 2;
doBlock(^{
result = n;
});
return result + i; /* Check value of 'result' */
}
int main (int argc, const char * argv[]) {
return I(42);
}

View File

@@ -1,43 +0,0 @@
// RUN: %clang -O0 -g %s -c -o %t.o
// RUN: %clang %t.o -o %t.out -framework Foundation
// RUN: %test_debuginfo %s %t.out
// REQUIRES: system-darwin
// Radar 9279956
// DEBUGGER: break 31
// DEBUGGER: r
// DEBUGGER: p m2
// CHECK: ${{[0-9]}} = 1
// DEBUGGER: p dbTransaction
// CHECK: ${{[0-9]}} = 0
// DEBUGGER: p master
// CHECK: ${{[0-9]}} = 0
#include <Cocoa/Cocoa.h>
extern void foo(void(^)(void));
@interface A:NSObject @end
@implementation A
- (void) helper {
int master = 0;
__block int m2 = 0;
__block int dbTransaction = 0;
int (^x)(void) = ^(void) { (void) self;
(void) master;
(void) dbTransaction;
m2++;
return m2;
};
master = x();
}
@end
void foo(void(^x)(void)) {}
int main() {
A *a = [A alloc];
[a helper];
return 0;
}

View File

@@ -1,25 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %clangxx %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
// DEBUGGER: break 14
// DEBUGGER: r
// DEBUGGER: p *this
// CHECK-NEXT-NOT: Cannot access memory at address
class A {
public:
A() : zero(0), data(42)
{
}
private:
int zero;
int data;
};
int main() {
A a;
return 0;
}

View File

@@ -1,41 +0,0 @@
// This test case checks debug info during register moves for an argument.
// RUN: %clang -arch x86_64 -mllvm -fast-isel=false %s -c -o %t.o
// RUN: %clang -arch x86_64 %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
//
// Radar 8412415
struct _mtx
{
long unsigned int ptr;
int waiters;
struct {
int tag;
int pad;
} mtxi;
};
int foobar(struct _mtx *mutex) {
int r = 1;
int l = 0;
int j = 0;
do {
if (mutex->waiters) {
r = 2;
}
j = bar(r, l);
++l;
} while (l < j);
return r + j;
}
int bar(int i, int j) {
return i + j;
}
int main() {
struct _mtx m;
m.waiters = 0;
return foobar(&m);
}

View File

@@ -1,31 +0,0 @@
// RUN: %clang -O0 -g %s -c -o %t.o
// RUN: %clang %t.o -o %t.out -framework Foundation
// RUN: %test_debuginfo %s %t.out
//
// REQUIRES: system-darwin
// Radar 8757124
// DEBUGGER: break 25
// DEBUGGER: r
// DEBUGGER: po thing
// CHECK: aaa
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *things = [NSArray arrayWithObjects:@"one", @"two", @"three" , nil];
for (NSString *thing in things) {
NSLog (@"%@", thing);
}
things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" , nil];
for (NSString *thing in things) {
NSLog (@"%@", thing);
}
[pool release];
return 0;
}

View File

@@ -1,27 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %test_debuginfo %s %t.o
// Radar 9168773
// DEBUGGER: ptype A
// Work around a gdb bug where it believes that a class is a
// struct if there aren't any methods - even though it's tagged
// as a class.
// CHECK: type = {{struct|class}} A {
// CHECK-NEXT: {{(public:){0,1}}}
// CHECK-NEXT: int MyData;
// CHECK-NEXT: }
class A;
class B {
public:
void foo(const A *p);
};
B iEntry;
class A {
public:
int MyData;
};
A irp;

View File

@@ -1,153 +0,0 @@
#!/bin/env python
"""
A gdb-compatible frontend for lldb that implements just enough
commands to run the tests in the debuginfo-tests repository with lldb.
"""
# ----------------------------------------------------------------------
# Auto-detect lldb python module.
import commands, platform, os, sys
try:
# Just try for LLDB in case PYTHONPATH is already correctly setup.
import lldb
except ImportError:
lldb_python_dirs = list()
# lldb is not in the PYTHONPATH, try some defaults for the current platform.
platform_system = platform.system()
if platform_system == 'Darwin':
# On Darwin, try the currently selected Xcode directory
xcode_dir = commands.getoutput("xcode-select --print-path")
if xcode_dir:
lldb_python_dirs.append(os.path.realpath(xcode_dir +
'/../SharedFrameworks/LLDB.framework/Resources/Python'))
lldb_python_dirs.append(xcode_dir +
'/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
lldb_python_dirs.append(
'/System/Library/PrivateFrameworks/LLDB.framework/Resources/Python')
success = False
for lldb_python_dir in lldb_python_dirs:
if os.path.exists(lldb_python_dir):
if not (sys.path.__contains__(lldb_python_dir)):
sys.path.append(lldb_python_dir)
try:
import lldb
except ImportError:
pass
else:
print 'imported lldb from: "%s"' % (lldb_python_dir)
success = True
break
if not success:
print "error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly"
sys.exit(1)
# ----------------------------------------------------------------------
# Command line option handling.
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--quiet', '-q', action="store_true", help='ignored')
parser.add_argument('-batch', action="store_true",
help='exit after processing comand line')
parser.add_argument('-n', action="store_true", help='ignore .lldb file')
parser.add_argument('-x', dest='script', type=file, help='execute commands from file')
parser.add_argument("target", help="the program to debug")
args = parser.parse_args()
# Create a new debugger instance.
debugger = lldb.SBDebugger.Create()
debugger.SkipLLDBInitFiles(args.n)
# Don't return from lldb function calls until the process stops.
debugger.SetAsync(False)
# Create a target from a file and arch.
arch = os.popen("file "+args.target).read().split()[-1]
target = debugger.CreateTargetWithFileAndArch(args.target, arch)
if not target:
print "Could not create target", args.target
sys.exit(1)
if not args.script:
print "Interactive mode is not implemented."
sys.exit(1)
import re
for command in args.script:
# Strip newline and whitespaces and split into words.
cmd = command[:-1].strip().split()
if not cmd:
continue
print '> %s'% command[:-1]
try:
if re.match('^r|(run)$', cmd[0]):
import time, random; time.sleep(random.randint(0,10))
error = lldb.SBError()
launchinfo = lldb.SBLaunchInfo([])
launchinfo.SetWorkingDirectory(os.getcwd())
process = target.Launch(launchinfo, error)
print error
if not process or error.fail:
state = process.GetState()
print "State = %d" % state
print """
ERROR: Could not launch process.
NOTE: There are several resons why this may happen:
* Root needs to run "DevToolsSecurity --enable".
* We launched ("run") more than one process simultaneously.
(cf. rdar://problem/14929651)
"""
sys.exit(1)
elif re.match('^b|(break)$', cmd[0]) and len(cmd) == 2:
if re.match('[0-9]+', cmd[1]):
# b line
mainfile = target.FindFunctions('main')[0].compile_unit.file
print target.BreakpointCreateByLocation(mainfile, int(cmd[1]))
else:
# b file:line
file, line = cmd[1].split(':')
print target.BreakpointCreateByLocation(file, int(line))
elif re.match('^ptype$', cmd[0]) and len(cmd) == 2:
# GDB's ptype has multiple incarnations depending on its
# argument (global variable, function, type). The definition
# here is for looking up the signature of a function and only
# if that fails it looks for a type with that name.
# Type lookup in LLDB would be "image lookup --type".
for elem in target.FindFunctions(cmd[1]):
print elem.function.type
continue
print target.FindFirstType(cmd[1])
elif re.match('^po$', cmd[0]) and len(cmd) > 1:
try:
opts = lldb.SBExpressionOptions()
opts.SetFetchDynamicValue(True)
opts.SetCoerceResultToId(True)
print target.EvaluateExpression(' '.join(cmd[1:]), opts)
except:
# FIXME: This is a fallback path for the lab.llvm.org
# buildbot running OS X 10.7; it should be removed.
thread = process.GetThreadAtIndex(0)
frame = thread.GetFrameAtIndex(0)
print frame.EvaluateExpression(' '.join(cmd[1:]))
elif re.match('^p|(print)$', cmd[0]) and len(cmd) > 1:
thread = process.GetThreadAtIndex(0)
frame = thread.GetFrameAtIndex(0)
print frame.EvaluateExpression(' '.join(cmd[1:]))
elif re.match('^q|(quit)$', cmd[0]):
sys.exit(0)
else:
print debugger.HandleCommand(' '.join(cmd))
except SystemExit, e: raise e
except:
print 'Could not handle the command "%s"' % ' '.join(cmd)

View File

@@ -1,21 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %test_debuginfo %s %t.o
// Radar 9440721
// If debug info for my_number() is emitted outside function foo's scope
// then a debugger may not be able to handle it. At least one version of
// gdb crashes in such cases.
// DEBUGGER: ptype foo
// CHECK: int (void)
int foo() {
struct Local {
static int my_number() {
return 42;
}
};
int i = 0;
i = Local::my_number();
return i + 1;
}

View File

@@ -1,71 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %clangxx %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
// Radar 8775834
// DEBUGGER: break 62
// DEBUGGER: r
// DEBUGGER: p a
// CHECK: ${{[0-9]+}} =
// LLDB does not print artificial members.
// CHECK: {{(_vptr\$A =)?.*}}m_int = 12
class A
{
public:
A (int i=0);
A (const A& rhs);
const A&
operator= (const A& rhs);
virtual ~A() {}
int get_int();
protected:
int m_int;
};
A::A (int i) :
m_int(i)
{
}
A::A (const A& rhs) :
m_int (rhs.m_int)
{
}
const A &
A::operator =(const A& rhs)
{
m_int = rhs.m_int;
return *this;
}
int A::get_int()
{
return m_int;
}
class B
{
public:
B () {}
A AInstance();
};
A
B::AInstance()
{
A a(12);
return a;
}
int main (int argc, char const *argv[])
{
B b;
int return_val = b.AInstance().get_int();
A a(b.AInstance());
return return_val;
}

View File

@@ -1,39 +0,0 @@
// RUN: %clangxx -O0 -g %s -o %t -c
// RUN: %clangxx %t -o %t.out
// RUN: %test_debuginfo %s %t.out
// FIXME: LLDB finds the wrong symbol for "C". rdar://problem/14933867
// XFAIL: darwin
// DEBUGGER: delete breakpoints
// DEBUGGER: break static-member.cpp:33
// DEBUGGER: r
// DEBUGGER: ptype C
// CHECK: {{struct|class}} C {
// CHECK: static const int a;
// CHECK-NEXT: static int b;
// CHECK-NEXT: static int c;
// CHECK-NEXT: int d;
// CHECK-NEXT: }
// DEBUGGER: p C::a
// CHECK: ${{[0-9]}} = 4
// DEBUGGER: p C::c
// CHECK: ${{[0-9]}} = 15
// PR14471, PR14734
class C {
public:
const static int a = 4;
static int b;
static int c;
int d;
};
int C::c = 15;
const int C::a;
int main() {
C instance_C;
return C::a;
}

View File

@@ -1,36 +0,0 @@
// RUN: %clangxx -O0 -g %s -o %t -c
// RUN: %clangxx %t -o %t.out
// RUN: %test_debuginfo %s %t.out
// DEBUGGER: delete breakpoints
// DEBUGGER: break static-member.cpp:33
// DEBUGGER: r
// DEBUGGER: ptype MyClass
// CHECK: {{struct|class}} MyClass {
// CHECK: static const int a;
// CHECK-NEXT: static int b;
// CHECK-NEXT: static int c;
// CHECK-NEXT: int d;
// CHECK-NEXT: }
// DEBUGGER: p MyClass::a
// CHECK: ${{[0-9]}} = 4
// DEBUGGER: p MyClass::c
// CHECK: ${{[0-9]}} = 15
// PR14471, PR14734
class MyClass {
public:
const static int a = 4;
static int b;
static int c;
int d;
};
int MyClass::c = 15;
const int MyClass::a;
int main() {
MyClass instance_MyClass;
return MyClass::a;
}

View File

@@ -1,2 +0,0 @@
N: Peter Collingbourne
E: peter@pcc.me.uk

View File

@@ -1,64 +0,0 @@
==============================================================================
libclc License
==============================================================================
The libclc library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
Copyright (c) 2011-2014 by the contributors listed in CREDITS.TXT
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* The names of the contributors may not be used to endorse or promote
products derived from this Software without specific prior written
permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyright (c) 2011-2014 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,52 +0,0 @@
libclc
------
libclc is an open source, BSD licensed implementation of the library
requirements of the OpenCL C programming language, as specified by the
OpenCL 1.1 Specification. The following sections of the specification
impose library requirements:
* 6.1: Supported Data Types
* 6.2.3: Explicit Conversions
* 6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
* 6.9: Preprocessor Directives and Macros
* 6.11: Built-in Functions
* 9.3: Double Precision Floating-Point
* 9.4: 64-bit Atomics
* 9.5: Writing to 3D image memory objects
* 9.6: Half Precision Floating-Point
libclc is intended to be used with the Clang compiler's OpenCL frontend.
libclc is designed to be portable and extensible. To this end, it provides
generic implementations of most library requirements, allowing the target
to override the generic implementation at the granularity of individual
functions.
libclc currently only supports the PTX target, but support for more
targets is welcome.
Compiling and installing with Make
----------------------------------
$ ./configure.py --with-llvm-config=/path/to/llvm-config && make
$ make install
Note you can use the DESTDIR Makefile variable to do staged installs.
$ make install DESTDIR=/path/for/staged/install
Compiling and installing with Ninja
-----------------------------------
$ ./configure.py -g ninja --with-llvm-config=/path/to/llvm-config && ninja
$ ninja install
Note you can use the DESTDIR environment variable to do staged installs.
$ DESTDIR=/path/for/staged/install ninja install
Website
-------
http://www.pcc.me.uk/~peter/libclc/

View File

@@ -1,100 +0,0 @@
import ninja_syntax
import os
# Simple meta-build system.
class Make(object):
def __init__(self):
self.output = open(self.output_filename(), 'w')
self.rules = {}
self.rule_text = ''
self.all_targets = []
self.default_targets = []
self.clean_files = []
self.distclean_files = []
self.output.write("""all::
ifndef VERBOSE
Verb = @
endif
""")
def output_filename(self):
return 'Makefile'
def rule(self, name, command, description=None, depfile=None,
generator=False):
self.rules[name] = {'command': command, 'description': description,
'depfile': depfile, 'generator': generator}
def build(self, output, rule, inputs=[], implicit=[], order_only=[]):
inputs = self._as_list(inputs)
implicit = self._as_list(implicit)
order_only = self._as_list(order_only)
output_dir = os.path.dirname(output)
if output_dir != '' and not os.path.isdir(output_dir):
os.makedirs(output_dir)
dollar_in = ' '.join(inputs)
subst = lambda text: text.replace('$in', dollar_in).replace('$out', output)
deps = ' '.join(inputs + implicit)
if order_only:
deps += ' | '
deps += ' '.join(order_only)
self.output.write('%s: %s\n' % (output, deps))
r = self.rules[rule]
command = subst(r['command'])
if r['description']:
desc = subst(r['description'])
self.output.write('\t@echo %s\n\t$(Verb) %s\n' % (desc, command))
else:
self.output.write('\t%s\n' % command)
if r['depfile']:
depfile = subst(r['depfile'])
self.output.write('-include '+depfile+'\n')
self.output.write('\n')
self.all_targets.append(output)
if r['generator']:
self.distclean_files.append(output)
if r['depfile']:
self.distclean_files.append(depfile)
else:
self.clean_files.append(output)
if r['depfile']:
self.distclean_files.append(depfile)
def _as_list(self, input):
if isinstance(input, list):
return input
return [input]
def default(self, paths):
self.default_targets += self._as_list(paths)
def finish(self):
self.output.write('all:: %s\n\n' % ' '.join(self.default_targets or self.all_targets))
self.output.write('clean: \n\trm -f %s\n\n' % ' '.join(self.clean_files))
self.output.write('distclean: clean\n\trm -f %s\n' % ' '.join(self.distclean_files))
class Ninja(ninja_syntax.Writer):
def __init__(self):
ninja_syntax.Writer.__init__(self, open(self.output_filename(), 'w'))
def output_filename(self):
return 'build.ninja'
def finish(self):
pass
def from_name(name):
if name == 'make':
return Make()
if name == 'ninja':
return Ninja()
raise LookupError, 'unknown generator: %s; supported generators are make and ninja' % name

View File

@@ -1,118 +0,0 @@
#!/usr/bin/python
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that already
use Python.
"""
import textwrap
import re
class Writer(object):
def __init__(self, output, width=78):
self.output = output
self.width = width
def newline(self):
self.output.write('\n')
def comment(self, text):
for line in textwrap.wrap(text, self.width - 2):
self.output.write('# ' + line + '\n')
def variable(self, key, value, indent=0):
if value is None:
return
if isinstance(value, list):
value = ' '.join(value)
self._line('%s = %s' % (key, value), indent)
def rule(self, name, command, description=None, depfile=None,
generator=False):
self._line('rule %s' % name)
self.variable('command', escape(command), indent=1)
if description:
self.variable('description', description, indent=1)
if depfile:
self.variable('depfile', depfile, indent=1)
if generator:
self.variable('generator', '1', indent=1)
def build(self, outputs, rule, inputs=None, implicit=None, order_only=None,
variables=None):
outputs = self._as_list(outputs)
all_inputs = self._as_list(inputs)[:]
if implicit:
all_inputs.append('|')
all_inputs.extend(self._as_list(implicit))
if order_only:
all_inputs.append('||')
all_inputs.extend(self._as_list(order_only))
self._line('build %s: %s %s' % (' '.join(outputs),
rule,
' '.join(all_inputs)))
if variables:
for key, val in variables:
self.variable(key, val, indent=1)
return outputs
def include(self, path):
self._line('include %s' % path)
def subninja(self, path):
self._line('subninja %s' % path)
def default(self, paths):
self._line('default %s' % ' '.join(self._as_list(paths)))
def _line(self, text, indent=0):
"""Write 'text' word-wrapped at self.width characters."""
leading_space = ' ' * indent
while len(text) > self.width:
# The text is too wide; wrap if possible.
# Find the rightmost space that would obey our width constraint.
available_space = self.width - len(leading_space) - len(' $')
space = text.rfind(' ', 0, available_space)
if space < 0:
# No such space; just use the first space we can find.
space = text.find(' ', available_space)
if space < 0:
# Give up on breaking.
break
self.output.write(leading_space + text[0:space] + ' $\n')
text = text[space+1:]
# Subsequent lines are continuations, so indent them.
leading_space = ' ' * (indent+2)
self.output.write(leading_space + text + '\n')
def _as_list(self, input):
if input is None:
return []
if isinstance(input, list):
return input
return [input]
def escape(string):
"""Escape a string such that Makefile and shell variables are
correctly escaped for use in a Ninja file.
"""
assert '\n' not in string, 'Ninja syntax does not allow newlines'
# We only have one special metacharacter: '$'.
# We should leave $in and $out untouched.
# Just look for makefile/shell style substitutions
return re.sub(r'(\$[{(][a-z_]+[})])',
r'$\1',
string,
flags=re.IGNORECASE)

View File

@@ -1,3 +0,0 @@
#!/bin/sh
clang -target nvptx--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang nvptx--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers -Dcl_khr_fp64 "$@"

View File

@@ -1,246 +0,0 @@
#!/usr/bin/python
def c_compiler_rule(b, name, description, compiler, flags):
command = "%s -MMD -MF $out.d %s -c -o $out $in" % (compiler, flags)
b.rule(name, command, description + " $out", depfile="$out.d")
version_major = 0;
version_minor = 0;
version_patch = 1;
from optparse import OptionParser
import os
import string
from subprocess import *
import sys
srcdir = os.path.dirname(sys.argv[0])
sys.path.insert(0, os.path.join(srcdir, 'build'))
import metabuild
p = OptionParser()
p.add_option('--with-llvm-config', metavar='PATH',
help='use given llvm-config script')
p.add_option('--with-cxx-compiler', metavar='PATH',
help='use given C++ compiler')
p.add_option('--prefix', metavar='PATH',
help='install to given prefix')
p.add_option('--libexecdir', metavar='PATH',
help='install *.bc to given dir')
p.add_option('--includedir', metavar='PATH',
help='install include files to given dir')
p.add_option('--pkgconfigdir', metavar='PATH',
help='install clc.pc to given dir')
p.add_option('-g', metavar='GENERATOR', default='make',
help='use given generator (default: make)')
(options, args) = p.parse_args()
llvm_config_exe = options.with_llvm_config or "llvm-config"
prefix = options.prefix
if not prefix:
prefix = '/usr/local'
libexecdir = options.libexecdir
if not libexecdir:
libexecdir = os.path.join(prefix, 'lib/clc')
includedir = options.includedir
if not includedir:
includedir = os.path.join(prefix, 'include')
pkgconfigdir = options.pkgconfigdir
if not pkgconfigdir:
pkgconfigdir = os.path.join(prefix, 'share/pkgconfig')
def llvm_config(args):
try:
proc = Popen([llvm_config_exe] + args, stdout=PIPE)
return proc.communicate()[0].rstrip().replace('\n', ' ')
except OSError:
print "Error executing llvm-config."
print "Please ensure that llvm-config is in your $PATH, or use --with-llvm-config."
sys.exit(1)
llvm_version = string.split(string.replace(llvm_config(['--version']), 'svn', ''), '.')
llvm_system_libs = ''
if (int(llvm_version[0]) == 3 and int(llvm_version[1]) >= 5) or int(llvm_version[0]) > 3:
llvm_system_libs = llvm_config(['--system-libs'])
llvm_bindir = llvm_config(['--bindir'])
llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' ' + \
llvm_system_libs + ' ' + \
llvm_config(['--ldflags'])
llvm_cxxflags = llvm_config(['--cxxflags']) + ' -fno-exceptions -fno-rtti'
llvm_clang = os.path.join(llvm_bindir, 'clang')
llvm_link = os.path.join(llvm_bindir, 'llvm-link')
llvm_opt = os.path.join(llvm_bindir, 'opt')
cxx_compiler = options.with_cxx_compiler
if not cxx_compiler:
cxx_compiler = os.path.join(llvm_bindir, 'clang++')
available_targets = {
'r600--' : { 'devices' :
[{'gpu' : 'cedar', 'aliases' : ['palm', 'sumo', 'sumo2', 'redwood', 'juniper']},
{'gpu' : 'cypress', 'aliases' : ['hemlock']},
{'gpu' : 'barts', 'aliases' : ['turks', 'caicos']},
{'gpu' : 'cayman', 'aliases' : ['aruba']},
{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 'bonaire', 'kabini', 'kaveri', 'hawaii']}]},
'nvptx--' : { 'devices' : [{'gpu' : '', 'aliases' : []}] },
'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : []}] },
'nvptx--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []}] },
'nvptx64--nvidiacl' : { 'devices' : [{'gpu' : '', 'aliases' : []}] }
}
default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--']
targets = args
if not targets:
targets = default_targets
b = metabuild.from_name(options.g)
b.rule("LLVM_AS", "%s -o $out $in" % os.path.join(llvm_bindir, "llvm-as"),
'LLVM-AS $out')
b.rule("LLVM_LINK", command = llvm_link + " -o $out $in",
description = 'LLVM-LINK $out')
b.rule("OPT", command = llvm_opt + " -O3 -o $out $in",
description = 'OPT $out')
c_compiler_rule(b, "LLVM_TOOL_CXX", 'CXX', cxx_compiler, llvm_cxxflags)
b.rule("LLVM_TOOL_LINK", cxx_compiler + " -o $out $in %s" % llvm_core_libs, 'LINK $out')
prepare_builtins = os.path.join('utils', 'prepare-builtins')
b.build(os.path.join('utils', 'prepare-builtins.o'), "LLVM_TOOL_CXX",
os.path.join(srcdir, 'utils', 'prepare-builtins.cpp'))
b.build(prepare_builtins, "LLVM_TOOL_LINK",
os.path.join('utils', 'prepare-builtins.o'))
b.rule("PREPARE_BUILTINS", "%s -o $out $in" % prepare_builtins,
'PREPARE-BUILTINS $out')
b.rule("PYTHON_GEN", "python < $in > $out", "PYTHON_GEN $out")
b.build('generic/lib/convert.cl', "PYTHON_GEN", ['generic/lib/gen_convert.py'])
manifest_deps = set([sys.argv[0], os.path.join(srcdir, 'build', 'metabuild.py'),
os.path.join(srcdir, 'build', 'ninja_syntax.py')])
install_files_bc = []
install_deps = []
# Create libclc.pc
clc = open('libclc.pc', 'w')
clc.write('includedir=%(inc)s\nlibexecdir=%(lib)s\n\nName: libclc\nDescription: Library requirements of the OpenCL C programming language\nVersion: %(maj)s.%(min)s.%(pat)s\nCflags: -I${includedir}\nLibs: -L${libexecdir}' %
{'inc': includedir, 'lib': libexecdir, 'maj': version_major, 'min': version_minor, 'pat': version_patch})
clc.close()
for target in targets:
(t_arch, t_vendor, t_os) = target.split('-')
archs = [t_arch]
if t_arch == 'nvptx' or t_arch == 'nvptx64':
archs.append('ptx')
archs.append('generic')
subdirs = []
for arch in archs:
subdirs.append("%s-%s-%s" % (arch, t_vendor, t_os))
subdirs.append("%s-%s" % (arch, t_os))
subdirs.append(arch)
incdirs = filter(os.path.isdir,
[os.path.join(srcdir, subdir, 'include') for subdir in subdirs])
libdirs = filter(lambda d: os.path.isfile(os.path.join(d, 'SOURCES')),
[os.path.join(srcdir, subdir, 'lib') for subdir in subdirs])
clang_cl_includes = ' '.join(["-I%s" % incdir for incdir in incdirs])
for device in available_targets[target]['devices']:
# The rule for building a .bc file for the specified architecture using clang.
clang_bc_flags = "-target %s -I`dirname $in` %s " \
"-fno-builtin " \
"-Dcl_clang_storage_class_specifiers " \
"-Dcl_khr_fp64 " \
"-Dcles_khr_int64 " \
"-D__CLC_INTERNAL " \
"-emit-llvm" % (target, clang_cl_includes)
if device['gpu'] != '':
clang_bc_flags += ' -mcpu=' + device['gpu']
clang_bc_rule = "CLANG_CL_BC_" + target + "_" + device['gpu']
c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)
objects = []
sources_seen = set()
if device['gpu'] == '':
full_target_name = target
obj_suffix = ''
else:
full_target_name = device['gpu'] + '-' + target
obj_suffix = '.' + device['gpu']
for libdir in libdirs:
subdir_list_file = os.path.join(libdir, 'SOURCES')
manifest_deps.add(subdir_list_file)
override_list_file = os.path.join(libdir, 'OVERRIDES')
# Add target overrides
if os.path.exists(override_list_file):
for override in open(override_list_file).readlines():
override = override.rstrip()
sources_seen.add(override)
for src in open(subdir_list_file).readlines():
src = src.rstrip()
if src not in sources_seen:
sources_seen.add(src)
obj = os.path.join(target, 'lib', src + obj_suffix + '.bc')
objects.append(obj)
src_file = os.path.join(libdir, src)
ext = os.path.splitext(src)[1]
if ext == '.ll':
b.build(obj, 'LLVM_AS', src_file)
else:
b.build(obj, clang_bc_rule, src_file)
builtins_link_bc = os.path.join(target, 'lib', 'builtins.link' + obj_suffix + '.bc')
builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt' + obj_suffix + '.bc')
builtins_bc = os.path.join('built_libs', full_target_name + '.bc')
b.build(builtins_link_bc, "LLVM_LINK", objects)
b.build(builtins_opt_bc, "OPT", builtins_link_bc)
b.build(builtins_bc, "PREPARE_BUILTINS", builtins_opt_bc, prepare_builtins)
install_files_bc.append((builtins_bc, builtins_bc))
install_deps.append(builtins_bc)
for alias in device['aliases']:
# Ninja cannot have multiple rules with same name so append suffix
ruleName = "CREATE_ALIAS_{0}_for_{1}".format(alias, device['gpu'])
b.rule(ruleName, "ln -fs %s $out" % os.path.basename(builtins_bc)
,"CREATE-ALIAS $out")
alias_file = os.path.join('built_libs', alias + '-' + target + '.bc')
b.build(alias_file, ruleName, builtins_bc)
install_files_bc.append((alias_file, alias_file))
install_deps.append(alias_file)
b.default(builtins_bc)
install_cmd = ' && '.join(['mkdir -p ${DESTDIR}/%(dst)s && cp -r %(src)s ${DESTDIR}/%(dst)s' %
{'src': file,
'dst': libexecdir}
for (file, dest) in install_files_bc])
install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r %(srcdir)s/generic/include/clc ${DESTDIR}/%(dst)s' %
{'old': install_cmd,
'dst': includedir,
'srcdir': srcdir}])
install_cmd = ' && '.join(['%(old)s && mkdir -p ${DESTDIR}/%(dst)s && cp -r libclc.pc ${DESTDIR}/%(dst)s' %
{'old': install_cmd,
'dst': pkgconfigdir}])
b.rule('install', command = install_cmd, description = 'INSTALL')
b.build('install', 'install', install_deps)
b.rule("configure", command = ' '.join(sys.argv), description = 'CONFIGURE',
generator = True)
b.build(b.output_filename(), 'configure', list(manifest_deps))
b.finish()

View File

@@ -1,68 +0,0 @@
#define as_char(x) __builtin_astype(x, char)
#define as_uchar(x) __builtin_astype(x, uchar)
#define as_short(x) __builtin_astype(x, short)
#define as_ushort(x) __builtin_astype(x, ushort)
#define as_int(x) __builtin_astype(x, int)
#define as_uint(x) __builtin_astype(x, uint)
#define as_long(x) __builtin_astype(x, long)
#define as_ulong(x) __builtin_astype(x, ulong)
#define as_float(x) __builtin_astype(x, float)
#define as_char2(x) __builtin_astype(x, char2)
#define as_uchar2(x) __builtin_astype(x, uchar2)
#define as_short2(x) __builtin_astype(x, short2)
#define as_ushort2(x) __builtin_astype(x, ushort2)
#define as_int2(x) __builtin_astype(x, int2)
#define as_uint2(x) __builtin_astype(x, uint2)
#define as_long2(x) __builtin_astype(x, long2)
#define as_ulong2(x) __builtin_astype(x, ulong2)
#define as_float2(x) __builtin_astype(x, float2)
#define as_char3(x) __builtin_astype(x, char3)
#define as_uchar3(x) __builtin_astype(x, uchar3)
#define as_short3(x) __builtin_astype(x, short3)
#define as_ushort3(x) __builtin_astype(x, ushort3)
#define as_int3(x) __builtin_astype(x, int3)
#define as_uint3(x) __builtin_astype(x, uint3)
#define as_long3(x) __builtin_astype(x, long3)
#define as_ulong3(x) __builtin_astype(x, ulong3)
#define as_float3(x) __builtin_astype(x, float3)
#define as_char4(x) __builtin_astype(x, char4)
#define as_uchar4(x) __builtin_astype(x, uchar4)
#define as_short4(x) __builtin_astype(x, short4)
#define as_ushort4(x) __builtin_astype(x, ushort4)
#define as_int4(x) __builtin_astype(x, int4)
#define as_uint4(x) __builtin_astype(x, uint4)
#define as_long4(x) __builtin_astype(x, long4)
#define as_ulong4(x) __builtin_astype(x, ulong4)
#define as_float4(x) __builtin_astype(x, float4)
#define as_char8(x) __builtin_astype(x, char8)
#define as_uchar8(x) __builtin_astype(x, uchar8)
#define as_short8(x) __builtin_astype(x, short8)
#define as_ushort8(x) __builtin_astype(x, ushort8)
#define as_int8(x) __builtin_astype(x, int8)
#define as_uint8(x) __builtin_astype(x, uint8)
#define as_long8(x) __builtin_astype(x, long8)
#define as_ulong8(x) __builtin_astype(x, ulong8)
#define as_float8(x) __builtin_astype(x, float8)
#define as_char16(x) __builtin_astype(x, char16)
#define as_uchar16(x) __builtin_astype(x, uchar16)
#define as_short16(x) __builtin_astype(x, short16)
#define as_ushort16(x) __builtin_astype(x, ushort16)
#define as_int16(x) __builtin_astype(x, int16)
#define as_uint16(x) __builtin_astype(x, uint16)
#define as_long16(x) __builtin_astype(x, long16)
#define as_ulong16(x) __builtin_astype(x, ulong16)
#define as_float16(x) __builtin_astype(x, float16)
#ifdef cl_khr_fp64
#define as_double(x) __builtin_astype(x, double)
#define as_double2(x) __builtin_astype(x, double2)
#define as_double3(x) __builtin_astype(x, double3)
#define as_double4(x) __builtin_astype(x, double4)
#define as_double8(x) __builtin_astype(x, double8)
#define as_double16(x) __builtin_astype(x, double16)
#endif

View File

@@ -1,3 +0,0 @@
#define __CLC_FUNCTION atomic_add
#include <clc/atomic/atomic_decl.inc>
#undef __CLC_FUNCTION

View File

@@ -1 +0,0 @@
#define atomic_dec(p) atomic_sub(p, 1);

View File

@@ -1,10 +0,0 @@
#define __CLC_DECLARE_ATOMIC(ADDRSPACE, TYPE) \
_CLC_OVERLOAD _CLC_DECL TYPE __CLC_FUNCTION (volatile ADDRSPACE TYPE *, TYPE);
#define __CLC_DECLARE_ATOMIC_ADDRSPACE(TYPE) \
__CLC_DECLARE_ATOMIC(global, TYPE); \
__CLC_DECLARE_ATOMIC(local, TYPE);
__CLC_DECLARE_ATOMIC_ADDRSPACE(int);
__CLC_DECLARE_ATOMIC_ADDRSPACE(uint);

View File

@@ -1 +0,0 @@
#define atomic_inc(p) atomic_add(p, 1);

View File

@@ -1,3 +0,0 @@
#define __CLC_FUNCTION atomic_sub
#include <clc/atomic/atomic_decl.inc>
#undef __CLC_FUNCTION

View File

@@ -1,2 +0,0 @@
_CLC_OVERLOAD _CLC_DECL int atom_add(global int *p, int val);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_add(global unsigned int *p, unsigned int val);

View File

@@ -1,2 +0,0 @@
_CLC_OVERLOAD _CLC_DECL int atom_dec(global int *p);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_dec(global unsigned int *p);

View File

@@ -1,2 +0,0 @@
_CLC_OVERLOAD _CLC_DECL int atom_inc(global int *p);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_inc(global unsigned int *p);

View File

@@ -1,2 +0,0 @@
_CLC_OVERLOAD _CLC_DECL int atom_sub(global int *p, int val);
_CLC_OVERLOAD _CLC_DECL unsigned int atom_sub(global unsigned int *p, unsigned int val);

View File

@@ -1,141 +0,0 @@
#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
/* Function Attributes */
#include <clc/clcfunc.h>
/* 6.1 Supported Data Types */
#include <clc/clctypes.h>
/* 6.2.3 Explicit Conversions */
#include <clc/convert.h>
/* 6.2.4.2 Reinterpreting Types Using as_type() and as_typen() */
#include <clc/as_type.h>
/* 6.9 Preprocessor Directives and Macros */
#include <clc/clcversion.h>
/* 6.11.1 Work-Item Functions */
#include <clc/workitem/get_global_size.h>
#include <clc/workitem/get_global_id.h>
#include <clc/workitem/get_local_size.h>
#include <clc/workitem/get_local_id.h>
#include <clc/workitem/get_num_groups.h>
#include <clc/workitem/get_group_id.h>
/* 6.11.2 Math Functions */
#include <clc/math/cos.h>
#include <clc/math/ceil.h>
#include <clc/math/exp.h>
#include <clc/math/exp10.h>
#include <clc/math/exp2.h>
#include <clc/math/fabs.h>
#include <clc/math/floor.h>
#include <clc/math/fma.h>
#include <clc/math/fmax.h>
#include <clc/math/fmin.h>
#include <clc/math/hypot.h>
#include <clc/math/log.h>
#include <clc/math/log2.h>
#include <clc/math/mad.h>
#include <clc/math/mix.h>
#include <clc/math/nextafter.h>
#include <clc/math/pow.h>
#include <clc/math/pown.h>
#include <clc/math/rint.h>
#include <clc/math/round.h>
#include <clc/math/sin.h>
#include <clc/math/sincos.h>
#include <clc/math/sqrt.h>
#include <clc/math/trunc.h>
#include <clc/math/native_cos.h>
#include <clc/math/native_divide.h>
#include <clc/math/native_exp.h>
#include <clc/math/native_exp10.h>
#include <clc/math/native_exp2.h>
#include <clc/math/native_log.h>
#include <clc/math/native_log2.h>
#include <clc/math/native_powr.h>
#include <clc/math/native_sin.h>
#include <clc/math/native_sqrt.h>
#include <clc/math/rsqrt.h>
/* 6.11.2.1 Floating-point macros */
#include <clc/float/definitions.h>
/* 6.11.3 Integer Functions */
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
#include <clc/integer/clz.h>
#include <clc/integer/hadd.h>
#include <clc/integer/mad24.h>
#include <clc/integer/mad_hi.h>
#include <clc/integer/mul24.h>
#include <clc/integer/mul_hi.h>
#include <clc/integer/rhadd.h>
#include <clc/integer/rotate.h>
#include <clc/integer/sub_sat.h>
#include <clc/integer/upsample.h>
/* 6.11.3 Integer Definitions */
#include <clc/integer/definitions.h>
/* 6.11.2 and 6.11.3 Shared Integer/Math Functions */
#include <clc/shared/clamp.h>
#include <clc/shared/max.h>
#include <clc/shared/min.h>
#include <clc/shared/vload.h>
#include <clc/shared/vstore.h>
/* 6.11.4 Common Functions */
#include <clc/common/sign.h>
/* 6.11.5 Geometric Functions */
#include <clc/geometric/cross.h>
#include <clc/geometric/dot.h>
#include <clc/geometric/length.h>
#include <clc/geometric/normalize.h>
/* 6.11.6 Relational Functions */
#include <clc/relational/all.h>
#include <clc/relational/any.h>
#include <clc/relational/bitselect.h>
#include <clc/relational/isequal.h>
#include <clc/relational/isgreater.h>
#include <clc/relational/isgreaterequal.h>
#include <clc/relational/isnan.h>
#include <clc/relational/isnotequal.h>
#include <clc/relational/select.h>
#include <clc/relational/signbit.h>
/* 6.11.8 Synchronization Functions */
#include <clc/synchronization/cl_mem_fence_flags.h>
#include <clc/synchronization/barrier.h>
/* 6.11.11 Atomic Functions */
#include <clc/atomic/atomic_add.h>
#include <clc/atomic/atomic_dec.h>
#include <clc/atomic/atomic_inc.h>
#include <clc/atomic/atomic_sub.h>
/* cl_khr_global_int32_base_atomics Extension Functions */
#include <clc/cl_khr_global_int32_base_atomics/atom_add.h>
#include <clc/cl_khr_global_int32_base_atomics/atom_dec.h>
#include <clc/cl_khr_global_int32_base_atomics/atom_inc.h>
#include <clc/cl_khr_global_int32_base_atomics/atom_sub.h>
/* libclc internal defintions */
#ifdef __CLC_INTERNAL
#include <math/clc_nextafter.h>
#endif
#pragma OPENCL EXTENSION all : disable

View File

@@ -1,4 +0,0 @@
#define _CLC_OVERLOAD __attribute__((overloadable))
#define _CLC_DECL
#define _CLC_DEF __attribute__((always_inline))
#define _CLC_INLINE __attribute__((always_inline)) inline

View File

@@ -1,86 +0,0 @@
/* 6.1.1 Built-in Scalar Data Types */
#include <stddef.h>
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
#define __stdint_join3(a,b,c) a ## b ## c
#define __intn_t(n) __stdint_join3(__INT, n, _TYPE__)
#define __uintn_t(n) __stdint_join3(unsigned __INT, n, _TYPE__)
typedef __intn_t(__INTPTR_WIDTH__) intptr_t;
typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
#undef __uintn_t
#undef __intn_t
#undef __stdint_join3
/* 6.1.2 Built-in Vector Data Types */
typedef __attribute__((ext_vector_type(2))) char char2;
typedef __attribute__((ext_vector_type(3))) char char3;
typedef __attribute__((ext_vector_type(4))) char char4;
typedef __attribute__((ext_vector_type(8))) char char8;
typedef __attribute__((ext_vector_type(16))) char char16;
typedef __attribute__((ext_vector_type(2))) uchar uchar2;
typedef __attribute__((ext_vector_type(3))) uchar uchar3;
typedef __attribute__((ext_vector_type(4))) uchar uchar4;
typedef __attribute__((ext_vector_type(8))) uchar uchar8;
typedef __attribute__((ext_vector_type(16))) uchar uchar16;
typedef __attribute__((ext_vector_type(2))) short short2;
typedef __attribute__((ext_vector_type(3))) short short3;
typedef __attribute__((ext_vector_type(4))) short short4;
typedef __attribute__((ext_vector_type(8))) short short8;
typedef __attribute__((ext_vector_type(16))) short short16;
typedef __attribute__((ext_vector_type(2))) ushort ushort2;
typedef __attribute__((ext_vector_type(3))) ushort ushort3;
typedef __attribute__((ext_vector_type(4))) ushort ushort4;
typedef __attribute__((ext_vector_type(8))) ushort ushort8;
typedef __attribute__((ext_vector_type(16))) ushort ushort16;
typedef __attribute__((ext_vector_type(2))) int int2;
typedef __attribute__((ext_vector_type(3))) int int3;
typedef __attribute__((ext_vector_type(4))) int int4;
typedef __attribute__((ext_vector_type(8))) int int8;
typedef __attribute__((ext_vector_type(16))) int int16;
typedef __attribute__((ext_vector_type(2))) uint uint2;
typedef __attribute__((ext_vector_type(3))) uint uint3;
typedef __attribute__((ext_vector_type(4))) uint uint4;
typedef __attribute__((ext_vector_type(8))) uint uint8;
typedef __attribute__((ext_vector_type(16))) uint uint16;
typedef __attribute__((ext_vector_type(2))) long long2;
typedef __attribute__((ext_vector_type(3))) long long3;
typedef __attribute__((ext_vector_type(4))) long long4;
typedef __attribute__((ext_vector_type(8))) long long8;
typedef __attribute__((ext_vector_type(16))) long long16;
typedef __attribute__((ext_vector_type(2))) ulong ulong2;
typedef __attribute__((ext_vector_type(3))) ulong ulong3;
typedef __attribute__((ext_vector_type(4))) ulong ulong4;
typedef __attribute__((ext_vector_type(8))) ulong ulong8;
typedef __attribute__((ext_vector_type(16))) ulong ulong16;
typedef __attribute__((ext_vector_type(2))) float float2;
typedef __attribute__((ext_vector_type(3))) float float3;
typedef __attribute__((ext_vector_type(4))) float float4;
typedef __attribute__((ext_vector_type(8))) float float8;
typedef __attribute__((ext_vector_type(16))) float float16;
/* 9.3 Double Precision Floating-Point */
#ifdef cl_khr_fp64
typedef __attribute__((ext_vector_type(2))) double double2;
typedef __attribute__((ext_vector_type(3))) double double3;
typedef __attribute__((ext_vector_type(4))) double double4;
typedef __attribute__((ext_vector_type(8))) double double8;
typedef __attribute__((ext_vector_type(16))) double double16;
#endif

View File

@@ -1,8 +0,0 @@
#if __OPENCL_VERSION__ >= 110
#define CLC_VERSION_1_0 100
#define CLC_VERSION_1_1 110
#endif
#if __OPENCL_VERSION__ >= 120
#define CLC_VERSION_1_2 120
#endif

View File

@@ -1,5 +0,0 @@
#define __CLC_FUNCTION sign
#define __CLC_BODY <clc/math/unary_decl.inc>
#include <clc/math/gentype.inc>
#undef __CLC_FUNCTION
#undef __CLC_BODY

View File

@@ -1,60 +0,0 @@
#define _CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
_CLC_OVERLOAD _CLC_DECL TO_TYPE convert_##TO_TYPE##SUFFIX(FROM_TYPE x);
#define _CLC_VECTOR_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
_CLC_CONVERT_DECL(FROM_TYPE, TO_TYPE, SUFFIX) \
_CLC_CONVERT_DECL(FROM_TYPE##2, TO_TYPE##2, SUFFIX) \
_CLC_CONVERT_DECL(FROM_TYPE##3, TO_TYPE##3, SUFFIX) \
_CLC_CONVERT_DECL(FROM_TYPE##4, TO_TYPE##4, SUFFIX) \
_CLC_CONVERT_DECL(FROM_TYPE##8, TO_TYPE##8, SUFFIX) \
_CLC_CONVERT_DECL(FROM_TYPE##16, TO_TYPE##16, SUFFIX)
#define _CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, char, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uchar, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, int, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, uint, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, short, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ushort, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, long, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, ulong, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, float, SUFFIX)
#ifdef cl_khr_fp64
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX) \
_CLC_VECTOR_CONVERT_DECL(FROM_TYPE, double, SUFFIX)
#else
#define _CLC_VECTOR_CONVERT_FROM(FROM_TYPE, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM1(FROM_TYPE, SUFFIX)
#endif
#define _CLC_VECTOR_CONVERT_TO1(SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(char, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(uchar, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(int, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(uint, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(short, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(ushort, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(long, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(ulong, SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(float, SUFFIX)
#ifdef cl_khr_fp64
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
_CLC_VECTOR_CONVERT_TO1(SUFFIX) \
_CLC_VECTOR_CONVERT_FROM(double, SUFFIX)
#else
#define _CLC_VECTOR_CONVERT_TO(SUFFIX) \
_CLC_VECTOR_CONVERT_TO1(SUFFIX)
#endif
#define _CLC_VECTOR_CONVERT_TO_SUFFIX(ROUND) \
_CLC_VECTOR_CONVERT_TO(_sat##ROUND) \
_CLC_VECTOR_CONVERT_TO(ROUND)
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtn)
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rte)
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtz)
_CLC_VECTOR_CONVERT_TO_SUFFIX(_rtp)
_CLC_VECTOR_CONVERT_TO_SUFFIX()

View File

@@ -1,74 +0,0 @@
#define MAXFLOAT 0x1.fffffep127f
#define HUGE_VALF __builtin_huge_valf()
#define INFINITY __builtin_inff()
#define NAN __builtin_nanf("")
#define FLT_DIG 6
#define FLT_MANT_DIG 24
#define FLT_MAX_10_EXP +38
#define FLT_MAX_EXP +128
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define FLT_RADIX 2
#define FLT_MAX MAXFLOAT
#define FLT_MIN 0x1.0p-126f
#define FLT_EPSILON 0x1.0p-23f
#define M_E_F 0x1.5bf0a8p+1f
#define M_LOG2E_F 0x1.715476p+0f
#define M_LOG10E_F 0x1.bcb7b2p-2f
#define M_LN2_F 0x1.62e430p-1f
#define M_LN10_F 0x1.26bb1cp+1f
#define M_PI_F 0x1.921fb6p+1f
#define M_PI_2_F 0x1.921fb6p+0f
#define M_PI_4_F 0x1.921fb6p-1f
#define M_1_PI_F 0x1.45f306p-2f
#define M_2_PI_F 0x1.45f306p-1f
#define M_2_SQRTPI_F 0x1.20dd76p+0f
#define M_SQRT2_F 0x1.6a09e6p+0f
#define M_SQRT1_2_F 0x1.6a09e6p-1f
#ifdef cl_khr_fp64
#define HUGE_VAL __builtin_huge_val()
#define DBL_DIG 15
#define DBL_MANT_DIG 53
#define DBL_MAX_10_EXP +308
#define DBL_MAX_EXP +1024
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define DBL_MAX 0x1.fffffffffffffp1023
#define DBL_MIN 0x1.0p-1022
#define DBL_EPSILON 0x1.0p-52
#define M_E 0x1.5bf0a8b145769p+1
#define M_LOG2E 0x1.71547652b82fep+0
#define M_LOG10E 0x1.bcb7b1526e50ep-2
#define M_LN2 0x1.62e42fefa39efp-1
#define M_LN10 0x1.26bb1bbb55516p+1
#define M_PI 0x1.921fb54442d18p+1
#define M_PI_2 0x1.921fb54442d18p+0
#define M_PI_4 0x1.921fb54442d18p-1
#define M_1_PI 0x1.45f306dc9c883p-2
#define M_2_PI 0x1.45f306dc9c883p-1
#define M_2_SQRTPI 0x1.20dd750429b6dp+0
#define M_SQRT2 0x1.6a09e667f3bcdp+0
#define M_SQRT1_2 0x1.6a09e667f3bcdp-1
#endif
#ifdef cl_khr_fp16
#if __OPENCL_VERSION__ >= 120
#define HALF_DIG 3
#define HALF_MANT_DIG 11
#define HALF_MAX_10_EXP +4
#define HALF_MAX_EXP +16
#define HALF_MIN_10_EXP -4
#define HALF_MIN_EXP -13
#endif
#endif

View File

@@ -1,7 +0,0 @@
_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
_CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);
#ifdef cl_khr_fp64
_CLC_OVERLOAD _CLC_DECL double3 cross(double3 p0, double3 p1);
_CLC_OVERLOAD _CLC_DECL double4 cross(double4 p0, double4 p1);
#endif

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/geometric/distance.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/geometric/dot.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT dot(__CLC_FLOATN p0, __CLC_FLOATN p1);

View File

@@ -1,45 +0,0 @@
#define __CLC_FLOAT float
#define __CLC_FLOATN float
#include __CLC_BODY
#undef __CLC_FLOATN
#define __CLC_FLOATN float2
#include __CLC_BODY
#undef __CLC_FLOATN
#define __CLC_FLOATN float3
#include __CLC_BODY
#undef __CLC_FLOATN
#define __CLC_FLOATN float4
#include __CLC_BODY
#undef __CLC_FLOATN
#undef __CLC_FLOAT
#ifdef cl_khr_fp64
#define __CLC_FLOAT double
#define __CLC_FLOATN double
#include __CLC_BODY
#undef __CLC_FLOATN
#define __CLC_FLOATN double2
#include __CLC_BODY
#undef __CLC_FLOATN
#define __CLC_FLOATN double3
#include __CLC_BODY
#undef __CLC_FLOATN
#define __CLC_FLOATN double4
#include __CLC_BODY
#undef __CLC_FLOATN
#undef __CLC_FLOAT
#endif
#undef __CLC_BODY

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/geometric/length.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_FLOAT length(__CLC_FLOATN p0);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/geometric/normalize.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_FLOATN normalize(__CLC_FLOATN p);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/abs.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs(__CLC_GENTYPE x);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/abs_diff.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_U_GENTYPE abs_diff(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/add_sat.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE add_sat(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/clz.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE clz(__CLC_GENTYPE x);

View File

@@ -1,15 +0,0 @@
#define CHAR_BIT 8
#define INT_MAX 2147483647
#define INT_MIN -2147483648
#define LONG_MAX 0x7fffffffffffffffL
#define LONG_MIN -0x8000000000000000L
#define SCHAR_MAX 127
#define SCHAR_MIN -128
#define CHAR_MAX 127
#define CHAR_MIN -128
#define SHRT_MAX 32767
#define SHRT_MIN -32768
#define UCHAR_MAX 255
#define USHRT_MAX 65535
#define UINT_MAX 0xffffffff
#define ULONG_MAX 0xffffffffffffffffUL

View File

@@ -1,435 +0,0 @@
//These 2 defines only change when switching between data sizes or base types to
//keep this file manageable.
#define __CLC_GENSIZE 8
#define __CLC_SCALAR_GENTYPE char
#define __CLC_GENTYPE char
#define __CLC_U_GENTYPE uchar
#define __CLC_S_GENTYPE char
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE char2
#define __CLC_U_GENTYPE uchar2
#define __CLC_S_GENTYPE char2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE char3
#define __CLC_U_GENTYPE uchar3
#define __CLC_S_GENTYPE char3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE char4
#define __CLC_U_GENTYPE uchar4
#define __CLC_S_GENTYPE char4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE char8
#define __CLC_U_GENTYPE uchar8
#define __CLC_S_GENTYPE char8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE char16
#define __CLC_U_GENTYPE uchar16
#define __CLC_S_GENTYPE char16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE uchar
#define __CLC_GENTYPE uchar
#define __CLC_U_GENTYPE uchar
#define __CLC_S_GENTYPE char
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uchar2
#define __CLC_U_GENTYPE uchar2
#define __CLC_S_GENTYPE char2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uchar3
#define __CLC_U_GENTYPE uchar3
#define __CLC_S_GENTYPE char3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uchar4
#define __CLC_U_GENTYPE uchar4
#define __CLC_S_GENTYPE char4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uchar8
#define __CLC_U_GENTYPE uchar8
#define __CLC_S_GENTYPE char8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uchar16
#define __CLC_U_GENTYPE uchar16
#define __CLC_S_GENTYPE char16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_GENSIZE
#define __CLC_GENSIZE 16
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE short
#define __CLC_GENTYPE short
#define __CLC_U_GENTYPE ushort
#define __CLC_S_GENTYPE short
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE short2
#define __CLC_U_GENTYPE ushort2
#define __CLC_S_GENTYPE short2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE short3
#define __CLC_U_GENTYPE ushort3
#define __CLC_S_GENTYPE short3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE short4
#define __CLC_U_GENTYPE ushort4
#define __CLC_S_GENTYPE short4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE short8
#define __CLC_U_GENTYPE ushort8
#define __CLC_S_GENTYPE short8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE short16
#define __CLC_U_GENTYPE ushort16
#define __CLC_S_GENTYPE short16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE ushort
#define __CLC_GENTYPE ushort
#define __CLC_U_GENTYPE ushort
#define __CLC_S_GENTYPE short
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ushort2
#define __CLC_U_GENTYPE ushort2
#define __CLC_S_GENTYPE short2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ushort3
#define __CLC_U_GENTYPE ushort3
#define __CLC_S_GENTYPE short3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ushort4
#define __CLC_U_GENTYPE ushort4
#define __CLC_S_GENTYPE short4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ushort8
#define __CLC_U_GENTYPE ushort8
#define __CLC_S_GENTYPE short8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ushort16
#define __CLC_U_GENTYPE ushort16
#define __CLC_S_GENTYPE short16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_GENSIZE
#define __CLC_GENSIZE 32
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE int
#define __CLC_GENTYPE int
#define __CLC_U_GENTYPE uint
#define __CLC_S_GENTYPE int
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE int2
#define __CLC_U_GENTYPE uint2
#define __CLC_S_GENTYPE int2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE int3
#define __CLC_U_GENTYPE uint3
#define __CLC_S_GENTYPE int3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE int4
#define __CLC_U_GENTYPE uint4
#define __CLC_S_GENTYPE int4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE int8
#define __CLC_U_GENTYPE uint8
#define __CLC_S_GENTYPE int8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE int16
#define __CLC_U_GENTYPE uint16
#define __CLC_S_GENTYPE int16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE uint
#define __CLC_GENTYPE uint
#define __CLC_U_GENTYPE uint
#define __CLC_S_GENTYPE int
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uint2
#define __CLC_U_GENTYPE uint2
#define __CLC_S_GENTYPE int2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uint3
#define __CLC_U_GENTYPE uint3
#define __CLC_S_GENTYPE int3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uint4
#define __CLC_U_GENTYPE uint4
#define __CLC_S_GENTYPE int4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uint8
#define __CLC_U_GENTYPE uint8
#define __CLC_S_GENTYPE int8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE uint16
#define __CLC_U_GENTYPE uint16
#define __CLC_S_GENTYPE int16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_GENSIZE
#define __CLC_GENSIZE 64
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE long
#define __CLC_GENTYPE long
#define __CLC_U_GENTYPE ulong
#define __CLC_S_GENTYPE long
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE long2
#define __CLC_U_GENTYPE ulong2
#define __CLC_S_GENTYPE long2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE long3
#define __CLC_U_GENTYPE ulong3
#define __CLC_S_GENTYPE long3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE long4
#define __CLC_U_GENTYPE ulong4
#define __CLC_S_GENTYPE long4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE long8
#define __CLC_U_GENTYPE ulong8
#define __CLC_S_GENTYPE long8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE long16
#define __CLC_U_GENTYPE ulong16
#define __CLC_S_GENTYPE long16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_SCALAR_GENTYPE
#define __CLC_SCALAR_GENTYPE ulong
#define __CLC_GENTYPE ulong
#define __CLC_U_GENTYPE ulong
#define __CLC_S_GENTYPE long
#define __CLC_SCALAR 1
#include __CLC_BODY
#undef __CLC_SCALAR
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ulong2
#define __CLC_U_GENTYPE ulong2
#define __CLC_S_GENTYPE long2
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ulong3
#define __CLC_U_GENTYPE ulong3
#define __CLC_S_GENTYPE long3
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ulong4
#define __CLC_U_GENTYPE ulong4
#define __CLC_S_GENTYPE long4
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ulong8
#define __CLC_U_GENTYPE ulong8
#define __CLC_S_GENTYPE long8
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#define __CLC_GENTYPE ulong16
#define __CLC_U_GENTYPE ulong16
#define __CLC_S_GENTYPE long16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_U_GENTYPE
#undef __CLC_S_GENTYPE
#undef __CLC_GENSIZE
#undef __CLC_SCALAR_GENTYPE
#undef __CLC_BODY

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/hadd.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE hadd(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,39 +0,0 @@
#define __CLC_GENTYPE int
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE int2
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE int4
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE int8
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE int16
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE uint
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE uint2
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE uint4
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE uint8
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE uint16
#include __CLC_BODY
#undef __CLC_GENTYPE

View File

@@ -1,3 +0,0 @@
#define __CLC_BODY <clc/integer/mad24.inc>
#include <clc/integer/integer-gentype.inc>
#undef __CLC_BODY

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad24(__CLC_GENTYPE x, __CLC_GENTYPE y, __CLC_GENTYPE z);

View File

@@ -1 +0,0 @@
#define mad_hi(a, b, c) (mul_hi((a),(b))+(c))

View File

@@ -1,3 +0,0 @@
#define __CLC_BODY <clc/integer/mul24.inc>
#include <clc/integer/integer-gentype.inc>
#undef __CLC_BODY

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mul24(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/mul_hi.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mul_hi(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/rhadd.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rhadd(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/rotate.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE rotate(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/integer/sub_sat.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE sub_sat(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,25 +0,0 @@
#define __CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \
_CLC_OVERLOAD _CLC_DECL BGENTYPE upsample(GENTYPE hi, UGENTYPE lo);
#define __CLC_UPSAMPLE_VEC(BGENTYPE, GENTYPE, UGENTYPE) \
__CLC_UPSAMPLE_DECL(BGENTYPE, GENTYPE, UGENTYPE) \
__CLC_UPSAMPLE_DECL(BGENTYPE##2, GENTYPE##2, UGENTYPE##2) \
__CLC_UPSAMPLE_DECL(BGENTYPE##3, GENTYPE##3, UGENTYPE##3) \
__CLC_UPSAMPLE_DECL(BGENTYPE##4, GENTYPE##4, UGENTYPE##4) \
__CLC_UPSAMPLE_DECL(BGENTYPE##8, GENTYPE##8, UGENTYPE##8) \
__CLC_UPSAMPLE_DECL(BGENTYPE##16, GENTYPE##16, UGENTYPE##16) \
#define __CLC_UPSAMPLE_TYPES() \
__CLC_UPSAMPLE_VEC(short, char, uchar) \
__CLC_UPSAMPLE_VEC(ushort, uchar, uchar) \
__CLC_UPSAMPLE_VEC(int, short, ushort) \
__CLC_UPSAMPLE_VEC(uint, ushort, ushort) \
__CLC_UPSAMPLE_VEC(long, int, uint) \
__CLC_UPSAMPLE_VEC(ulong, uint, uint) \
__CLC_UPSAMPLE_TYPES()
#undef __CLC_UPSAMPLE_TYPES
#undef __CLC_UPSAMPLE_DECL
#undef __CLC_UPSAMPLE_VEC

View File

@@ -1,6 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, __CLC_GENTYPE b);
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, float b);
#ifdef cl_khr_fp64
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE a, double b);
#endif

View File

@@ -1,18 +0,0 @@
_CLC_OVERLOAD float __CLC_FUNCTION(float, float) __asm(__CLC_INTRINSIC ".f32");
_CLC_OVERLOAD float2 __CLC_FUNCTION(float2, float2) __asm(__CLC_INTRINSIC ".v2f32");
_CLC_OVERLOAD float3 __CLC_FUNCTION(float3, float3) __asm(__CLC_INTRINSIC ".v3f32");
_CLC_OVERLOAD float4 __CLC_FUNCTION(float4, float4) __asm(__CLC_INTRINSIC ".v4f32");
_CLC_OVERLOAD float8 __CLC_FUNCTION(float8, float8) __asm(__CLC_INTRINSIC ".v8f32");
_CLC_OVERLOAD float16 __CLC_FUNCTION(float16, float16) __asm(__CLC_INTRINSIC ".v16f32");
#ifdef cl_khr_fp64
_CLC_OVERLOAD double __CLC_FUNCTION(double, double) __asm(__CLC_INTRINSIC ".f64");
_CLC_OVERLOAD double2 __CLC_FUNCTION(double2, double2) __asm(__CLC_INTRINSIC ".v2f64");
_CLC_OVERLOAD double3 __CLC_FUNCTION(double3, double3) __asm(__CLC_INTRINSIC ".v3f64");
_CLC_OVERLOAD double4 __CLC_FUNCTION(double4, double4) __asm(__CLC_INTRINSIC ".v4f64");
_CLC_OVERLOAD double8 __CLC_FUNCTION(double8, double8) __asm(__CLC_INTRINSIC ".v8f64");
_CLC_OVERLOAD double16 __CLC_FUNCTION(double16, double16) __asm(__CLC_INTRINSIC ".v16f64");
#endif
#undef __CLC_FUNCTION
#undef __CLC_INTRINSIC

View File

@@ -1,6 +0,0 @@
#undef ceil
#define ceil __clc_ceil
#define __CLC_FUNCTION __clc_ceil
#define __CLC_INTRINSIC "llvm.ceil"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,11 +0,0 @@
#define __CLC_BODY <clc/math/binary_decl.inc>
#define __CLC_FUNCTION nextafter
#include <clc/math/gentype.inc>
#undef __CLC_FUNCTION
#define __CLC_FUNCTION __clc_nextafter
#include <clc/math/gentype.inc>
#undef __CLC_FUNCTION
#undef __CLC_BODY

View File

@@ -1,6 +0,0 @@
#undef cos
#define cos __clc_cos
#define __CLC_FUNCTION __clc_cos
#define __CLC_INTRINSIC "llvm.cos"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,9 +0,0 @@
#undef exp
#define __CLC_BODY <clc/math/unary_decl.inc>
#define __CLC_FUNCTION exp
#include <clc/math/gentype.inc>
#undef __CLC_BODY
#undef __CLC_FUNCTION

View File

@@ -1,9 +0,0 @@
#undef exp10
#define __CLC_BODY <clc/math/unary_decl.inc>
#define __CLC_FUNCTION exp10
#include <clc/math/gentype.inc>
#undef __CLC_BODY
#undef __CLC_FUNCTION

View File

@@ -1,6 +0,0 @@
#undef exp2
#define exp2 __clc_exp2
#define __CLC_FUNCTION __clc_exp2
#define __CLC_INTRINSIC "llvm.exp2"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,6 +0,0 @@
#undef fabs
#define fabs __clc_fabs
#define __CLC_FUNCTION __clc_fabs
#define __CLC_INTRINSIC "llvm.fabs"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,6 +0,0 @@
#undef floor
#define floor __clc_floor
#define __CLC_FUNCTION __clc_floor
#define __CLC_INTRINSIC "llvm.floor"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,6 +0,0 @@
#undef fma
#define fma __clc_fma
#define __CLC_FUNCTION __clc_fma
#define __CLC_INTRINSIC "llvm.fma"
#include <clc/math/ternary_intrin.inc>

View File

@@ -1,11 +0,0 @@
#undef fmax
#define fmax __clc_fmax
#define __CLC_BODY <clc/math/binary_decl.inc>
#define __CLC_FUNCTION __clc_fmax
#include <clc/math/gentype.inc>
#undef __CLC_BODY
#undef __CLC_FUNCTION

View File

@@ -1,11 +0,0 @@
#undef fmin
#define fmin __clc_fmin
#define __CLC_BODY <clc/math/binary_decl.inc>
#define __CLC_FUNCTION __clc_fmin
#include <clc/math/gentype.inc>
#undef __CLC_BODY
#undef __CLC_FUNCTION

View File

@@ -1,67 +0,0 @@
#define __CLC_SCALAR_GENTYPE float
#define __CLC_FPSIZE 32
#define __CLC_GENTYPE float
#define __CLC_SCALAR
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_SCALAR
#define __CLC_GENTYPE float2
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE float3
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE float4
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE float8
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE float16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_FPSIZE
#undef __CLC_SCALAR_GENTYPE
#ifdef cl_khr_fp64
#define __CLC_SCALAR_GENTYPE double
#define __CLC_FPSIZE 64
#define __CLC_SCALAR
#define __CLC_GENTYPE double
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_SCALAR
#define __CLC_GENTYPE double2
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE double3
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE double4
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE double8
#include __CLC_BODY
#undef __CLC_GENTYPE
#define __CLC_GENTYPE double16
#include __CLC_BODY
#undef __CLC_GENTYPE
#undef __CLC_FPSIZE
#undef __CLC_SCALAR_GENTYPE
#endif
#undef __CLC_BODY

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/math/hypot.inc>
#include <clc/math/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE hypot(__CLC_GENTYPE x, __CLC_GENTYPE y);

View File

@@ -1,4 +0,0 @@
#undef log
// log(x) = log2(x) * (1/log2(e))
#define log(val) (__clc_log2(val) * 0.693147181f)

View File

@@ -1,6 +0,0 @@
#undef log2
#define log2 __clc_log2
#define __CLC_FUNCTION __clc_log2
#define __CLC_INTRINSIC "llvm.log2"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/math/mad.inc>
#include <clc/math/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mad(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c);

View File

@@ -1,2 +0,0 @@
#define __CLC_BODY <clc/math/mix.inc>
#include <clc/math/gentype.inc>

View File

@@ -1,5 +0,0 @@
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_GENTYPE c);
#ifndef __CLC_SCALAR
_CLC_OVERLOAD _CLC_DECL __CLC_GENTYPE mix(__CLC_GENTYPE a, __CLC_GENTYPE b, __CLC_SCALAR_GENTYPE c);
#endif

View File

@@ -1 +0,0 @@
#define native_cos cos

View File

@@ -1 +0,0 @@
#define native_divide(x, y) ((x) / (y))

View File

@@ -1 +0,0 @@
#define native_exp exp

View File

@@ -1 +0,0 @@
#define native_exp10 exp10

View File

@@ -1 +0,0 @@
#define native_exp2 exp2

Some files were not shown because too many files have changed in this diff Show More