1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 #include "Reactor.hpp"
21 int reference(int *p, int y)
26 for(int i = 0; i < 10; i++)
28 z += (2 << i) - (i / 3);
38 Routine *routine = nullptr;
41 Function<Int(Pointer<Int>, Int)> function;
43 Pointer<Int> p = function.Arg<0>();
45 Int y = function.Arg<1>();
48 For(Int i = 0, i < 10, i++)
50 z += (2 << i) - (i / 3);
58 routine = function(L"one");
62 int (*callable)(int*, int) = (int(*)(int*,int))routine->getEntry();
64 int result = callable(&one[1], 2);
65 assert(result == reference(&one[1], 2));