From 5a3c67da10acd78983a8842d52f03c9b3ff93eb9 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Sat, 17 Dec 2016 02:17:42 -0500 Subject: [PATCH] test: moved over the codegen portion of the tests, most of it had to be disabled. --- src/main/java/com/aparapi/Config.java | 14 +- src/main/java/com/aparapi/Kernel.java | 12 +- .../com/aparapi/internal/jni/ConfigJNI.java | 10 +- .../aparapi/internal/jni/KernelArgJNI.java | 2 +- .../aparapi/internal/model/Entrypoint.java | 2 +- .../aparapi/internal/model/MethodModel.java | 2 +- .../aparapi/internal/opencl/OpenCLLoader.java | 2 +- .../aparapi/internal/writer/KernelWriter.java | 2 +- .../com/aparapi/codegen/CodeGenJUnitBase.java | 137 +++++ .../com/aparapi/codegen/CreateJUnitTest.java | 158 +++++ src/test/java/com/aparapi/codegen/Diff.java | 282 +++++++++ .../com/aparapi/codegen/KernelHelper.java | 71 +++ src/test/java/com/aparapi/codegen/Source.java | 201 +++++++ .../java/com/aparapi/codegen/SwingDiff.java | 216 +++++++ .../codegen/test/Access2DIntArray.java | 25 + .../codegen/test/Access2DIntArrayTest.java | 65 ++ .../codegen/test/AccessBooleanArray.java | 59 ++ .../codegen/test/AccessBooleanArrayTest.java | 59 ++ .../aparapi/codegen/test/AccessByteArray.java | 62 ++ .../codegen/test/AccessByteArrayTest.java | 55 ++ .../codegen/test/AccessDoubleArray.java | 54 ++ .../codegen/test/AccessDoubleArrayTest.java | 57 ++ .../codegen/test/AccessFloatArray.java | 52 ++ .../codegen/test/AccessFloatArrayTest.java | 55 ++ .../aparapi/codegen/test/AccessIntArray.java | 52 ++ .../codegen/test/AccessIntArrayTest.java | 55 ++ .../aparapi/codegen/test/AccessLongArray.java | 52 ++ .../codegen/test/AccessLongArrayTest.java | 55 ++ .../codegen/test/AccessNested2DIntArray.java | 28 + .../test/AccessNested2DIntArrayTest.java | 68 +++ .../codegen/test/AccessShortArray.java | 52 ++ .../codegen/test/AccessShortArrayTest.java | 55 ++ .../codegen/test/AndOrAndPrecedence.java | 59 ++ .../codegen/test/AndOrAndPrecedenceTest.java | 35 ++ .../aparapi/codegen/test/AndOrPrecedence.java | 57 ++ .../codegen/test/AndOrPrecedence2.java | 57 ++ .../codegen/test/AndOrPrecedence2Test.java | 35 ++ .../codegen/test/AndOrPrecedenceTest.java | 35 ++ .../aparapi/codegen/test/ArbitraryScope.java | 118 ++++ .../aparapi/codegen/test/ArbitraryScope2.java | 119 ++++ .../codegen/test/ArbitraryScope2Test.java | 35 ++ .../codegen/test/ArbitraryScopeSimple.java | 62 ++ .../test/ArbitraryScopeSimpleTest.java | 35 ++ .../codegen/test/ArbitraryScopeTest.java | 35 ++ .../codegen/test/ArrayTortureIssue35.java | 52 ++ .../codegen/test/ArrayTortureIssue35Test.java | 35 ++ .../codegen/test/Assign2DIntArray.java | 25 + .../codegen/test/Assign2DIntArrayTest.java | 35 ++ .../test/AssignAndPassAsParameter.java | 64 ++ .../test/AssignAndPassAsParameterSimple.java | 29 + .../AssignAndPassAsParameterSimpleTest.java | 35 ++ .../test/AssignAndPassAsParameterTest.java | 35 ++ .../com/aparapi/codegen/test/AssignField.java | 25 + .../aparapi/codegen/test/AssignFieldTest.java | 35 ++ .../aparapi/codegen/test/Atomic32Pragma.java | 59 ++ .../codegen/test/Atomic32PragmaTest.java | 35 ++ .../aparapi/codegen/test/BooleanToggle.java | 65 ++ .../codegen/test/BooleanToggleTest.java | 35 ++ .../java/com/aparapi/codegen/test/Break.java | 29 + .../com/aparapi/codegen/test/BreakTest.java | 35 ++ .../com/aparapi/codegen/test/ByteParams.java | 60 ++ .../codegen/test/ByteParamsSimple.java | 57 ++ .../codegen/test/ByteParamsSimpleTest.java | 35 ++ .../aparapi/codegen/test/ByteParamsTest.java | 35 ++ .../aparapi/codegen/test/CallGetPassId.java | 46 ++ .../codegen/test/CallGetPassIdTest.java | 35 ++ .../com/aparapi/codegen/test/CallObject.java | 36 ++ .../codegen/test/CallObjectStatic.java | 60 ++ .../codegen/test/CallObjectStaticTest.java | 35 ++ .../aparapi/codegen/test/CallObjectTest.java | 35 ++ .../aparapi/codegen/test/CallRunSuper.java | 63 ++ .../codegen/test/CallRunSuperTest.java | 35 ++ .../test/CallStaticInAnotherClass.java | 67 +++ .../test/CallStaticInAnotherClassTest.java | 35 ++ .../com/aparapi/codegen/test/CallSuper.java | 65 ++ .../aparapi/codegen/test/CallSuperTest.java | 35 ++ .../com/aparapi/codegen/test/CallTwice.java | 58 ++ .../aparapi/codegen/test/CallTwiceTest.java | 35 ++ .../aparapi/codegen/test/CharArrayField.java | 47 ++ .../codegen/test/CharArrayFieldTest.java | 35 ++ .../aparapi/codegen/test/CharAsParameter.java | 56 ++ .../codegen/test/CharAsParameterTest.java | 35 ++ .../com/aparapi/codegen/test/CharType.java | 52 ++ .../aparapi/codegen/test/CharTypeTest.java | 35 ++ .../test/ClassHasStaticFieldAccess.java | 59 ++ .../test/ClassHasStaticFieldAccessTest.java | 35 ++ .../codegen/test/ClassHasStaticMethod.java | 69 +++ .../test/ClassHasStaticMethodSimple.java | 52 ++ .../test/ClassHasStaticMethodSimpleTest.java | 35 ++ .../test/ClassHasStaticMethodTest.java | 35 ++ .../codegen/test/CompositeArbitraryScope.java | 199 +++++++ .../test/CompositeArbitraryScopeTest.java | 35 ++ .../test/ConstantAssignInExpression.java | 54 ++ .../test/ConstantAssignInExpressionTest.java | 35 ++ .../com/aparapi/codegen/test/Continue.java | 55 ++ .../aparapi/codegen/test/ContinueTest.java | 35 ++ .../aparapi/codegen/test/ContinueTorture.java | 52 ++ .../codegen/test/ContinueTortureTest.java | 35 ++ .../aparapi/codegen/test/DirectRecursion.java | 34 ++ .../codegen/test/DirectRecursionTest.java | 35 ++ .../com/aparapi/codegen/test/DoWhile.java | 53 ++ .../com/aparapi/codegen/test/DoWhileTest.java | 35 ++ .../java/com/aparapi/codegen/test/Drem.java | 58 ++ .../com/aparapi/codegen/test/DremTest.java | 35 ++ .../com/aparapi/codegen/test/EarlyReturn.java | 52 ++ .../aparapi/codegen/test/EarlyReturnTest.java | 35 ++ .../codegen/test/EmptyWhileWithInc.java | 43 ++ .../codegen/test/EmptyWhileWithIncTest.java | 35 ++ .../codegen/test/EntrypointRecursion.java | 35 ++ .../codegen/test/EntrypointRecursionTest.java | 35 ++ .../java/com/aparapi/codegen/test/Ex.java | 52 ++ .../java/com/aparapi/codegen/test/ExTest.java | 35 ++ .../codegen/test/FirstAssignInExpression.java | 57 ++ .../test/FirstAssignInExpression2.java | 63 ++ .../test/FirstAssignInExpression2Test.java | 35 ++ .../test/FirstAssignInExpressionTest.java | 35 ++ .../com/aparapi/codegen/test/FloatParams.java | 59 ++ .../codegen/test/FloatParamsSimple.java | 53 ++ .../codegen/test/FloatParamsSimpleTest.java | 35 ++ .../aparapi/codegen/test/FloatParamsTest.java | 35 ++ .../java/com/aparapi/codegen/test/For.java | 48 ++ .../java/com/aparapi/codegen/test/ForAnd.java | 50 ++ .../aparapi/codegen/test/ForAndMandel.java | 102 ++++ .../test/ForAndMandelNoInitialize.java | 103 ++++ .../test/ForAndMandelNoInitializeTest.java | 35 ++ .../codegen/test/ForAndMandelTest.java | 35 ++ .../com/aparapi/codegen/test/ForAndTest.java | 35 ++ .../com/aparapi/codegen/test/ForAsFirst.java | 48 ++ .../aparapi/codegen/test/ForAsFirstTest.java | 35 ++ .../codegen/test/ForBooleanToggle.java | 75 +++ .../codegen/test/ForBooleanToggleTest.java | 35 ++ .../com/aparapi/codegen/test/ForBreak.java | 33 ++ .../aparapi/codegen/test/ForBreakTest.java | 35 ++ .../com/aparapi/codegen/test/ForEach.java | 32 + .../com/aparapi/codegen/test/ForEachTest.java | 35 ++ .../java/com/aparapi/codegen/test/ForIf.java | 54 ++ .../com/aparapi/codegen/test/ForIfMandel.java | 109 ++++ .../aparapi/codegen/test/ForIfMandelTest.java | 35 ++ .../com/aparapi/codegen/test/ForIfTest.java | 35 ++ .../com/aparapi/codegen/test/ForTest.java | 35 ++ .../java/com/aparapi/codegen/test/Frem.java | 55 ++ .../com/aparapi/codegen/test/FremTest.java | 35 ++ .../codegen/test/IEEERemainderDouble.java | 60 ++ .../codegen/test/IEEERemainderDoubleTest.java | 35 ++ .../codegen/test/IEEERemainderFloat.java | 58 ++ .../codegen/test/IEEERemainderFloatTest.java | 35 ++ .../java/com/aparapi/codegen/test/If.java | 53 ++ .../java/com/aparapi/codegen/test/IfAnd.java | 53 ++ .../com/aparapi/codegen/test/IfAndAnd.java | 53 ++ .../com/aparapi/codegen/test/IfAndAndAnd.java | 53 ++ .../aparapi/codegen/test/IfAndAndAndTest.java | 35 ++ .../aparapi/codegen/test/IfAndAndTest.java | 35 ++ .../com/aparapi/codegen/test/IfAndOrAnd.java | 53 ++ .../aparapi/codegen/test/IfAndOrAndTest.java | 35 ++ .../com/aparapi/codegen/test/IfAndTest.java | 35 ++ .../codegen/test/IfBooleanAndAndAnd.java | 56 ++ .../codegen/test/IfBooleanAndAndAndTest.java | 35 ++ .../codegen/test/IfBooleanAndAndOr.java | 56 ++ .../codegen/test/IfBooleanAndAndOrTest.java | 35 ++ .../codegen/test/IfBooleanAndOrAnd.java | 56 ++ .../codegen/test/IfBooleanAndOrAndTest.java | 35 ++ .../codegen/test/IfBooleanAndOrOr.java | 56 ++ .../codegen/test/IfBooleanAndOrOrTest.java | 35 ++ .../codegen/test/IfBooleanOrAndAnd.java | 56 ++ .../codegen/test/IfBooleanOrAndAndTest.java | 35 ++ .../codegen/test/IfBooleanOrAndOr.java | 59 ++ .../codegen/test/IfBooleanOrAndOrTest.java | 35 ++ .../codegen/test/IfBooleanOrOrAnd.java | 56 ++ .../codegen/test/IfBooleanOrOrAndTest.java | 35 ++ .../aparapi/codegen/test/IfBooleanOrOrOr.java | 56 ++ .../codegen/test/IfBooleanOrOrOrTest.java | 35 ++ .../java/com/aparapi/codegen/test/IfElse.java | 57 ++ .../com/aparapi/codegen/test/IfElseAnd.java | 57 ++ .../aparapi/codegen/test/IfElseAndAndAnd.java | 57 ++ .../codegen/test/IfElseAndAndAndTest.java | 35 ++ .../aparapi/codegen/test/IfElseAndTest.java | 35 ++ .../codegen/test/IfElseIfElseIfElse.java | 120 ++++ .../codegen/test/IfElseIfElseIfElseTest.java | 35 ++ .../codegen/test/IfElseNot__OrOr_And_.java | 57 ++ .../test/IfElseNot__OrOr_And_Test.java | 35 ++ .../aparapi/codegen/test/IfElseOrOrAnd.java | 57 ++ .../codegen/test/IfElseOrOrAndTest.java | 35 ++ .../aparapi/codegen/test/IfElseOrOrOr.java | 57 ++ .../codegen/test/IfElseOrOrOrTest.java | 35 ++ .../com/aparapi/codegen/test/IfElseTest.java | 35 ++ .../codegen/test/IfElse_And_Or_And.java | 60 ++ .../codegen/test/IfElse_And_Or_AndTest.java | 35 ++ .../aparapi/codegen/test/IfElse_OrOr_And.java | 57 ++ .../codegen/test/IfElse_OrOr_AndTest.java | 35 ++ .../codegen/test/IfElse_Or_And_Or.java | 60 ++ .../codegen/test/IfElse_Or_And_OrTest.java | 35 ++ .../java/com/aparapi/codegen/test/IfOr.java | 53 ++ .../com/aparapi/codegen/test/IfOrAndOr.java | 53 ++ .../aparapi/codegen/test/IfOrAndOrTest.java | 35 ++ .../java/com/aparapi/codegen/test/IfOrOr.java | 53 ++ .../com/aparapi/codegen/test/IfOrOrAnd.java | 53 ++ .../aparapi/codegen/test/IfOrOrAndTest.java | 35 ++ .../com/aparapi/codegen/test/IfOrOrOr.java | 53 ++ .../aparapi/codegen/test/IfOrOrOrTest.java | 35 ++ .../com/aparapi/codegen/test/IfOrOrTest.java | 35 ++ .../com/aparapi/codegen/test/IfOrTest.java | 35 ++ .../java/com/aparapi/codegen/test/IfTest.java | 35 ++ .../test/If_IfElseIfElseElse_Else.java | 75 +++ .../test/If_IfElseIfElseElse_ElseTest.java | 35 ++ .../aparapi/codegen/test/If_IfElse_Else.java | 67 +++ .../codegen/test/If_IfElse_ElseTest.java | 35 ++ .../codegen/test/If_IfElse_Else_IfElse_.java | 141 +++++ .../test/If_IfElse_Else_IfElse_Test.java | 35 ++ .../com/aparapi/codegen/test/If_If_Else.java | 74 +++ .../com/aparapi/codegen/test/If_If_Else2.java | 59 ++ .../aparapi/codegen/test/If_If_Else2Test.java | 35 ++ .../aparapi/codegen/test/If_If_ElseTest.java | 35 ++ .../aparapi/codegen/test/If_If_Else_If_.java | 79 +++ .../codegen/test/If_If_Else_If_Test.java | 35 ++ .../com/aparapi/codegen/test/If_OrOr_And.java | 53 ++ .../aparapi/codegen/test/If_OrOr_AndTest.java | 35 ++ .../aparapi/codegen/test/If_While_Else.java | 59 ++ .../codegen/test/If_While_ElseTest.java | 35 ++ .../codegen/test/If_While_Else_While.java | 61 ++ .../codegen/test/If_While_Else_WhileTest.java | 35 ++ .../codegen/test/ImplementsInterface.java | 67 +++ .../codegen/test/ImplementsInterfaceTest.java | 35 ++ .../codegen/test/IncArrayArgContent.java | 58 ++ .../codegen/test/IncArrayArgContentTest.java | 35 ++ .../com/aparapi/codegen/test/IncField.java | 25 + .../aparapi/codegen/test/IncFieldTest.java | 35 ++ .../codegen/test/IndirectRecursion.java | 41 ++ .../codegen/test/IndirectRecursionTest.java | 35 ++ .../com/aparapi/codegen/test/Interface.java | 37 ++ .../aparapi/codegen/test/InterfaceTest.java | 35 ++ .../com/aparapi/codegen/test/LongCompare.java | 55 ++ .../aparapi/codegen/test/LongCompareTest.java | 35 ++ .../aparapi/codegen/test/LongCompares.java | 53 ++ .../codegen/test/LongComparesTest.java | 35 ++ .../java/com/aparapi/codegen/test/Loops.java | 56 ++ .../com/aparapi/codegen/test/LoopsTest.java | 35 ++ .../com/aparapi/codegen/test/MathAbs.java | 60 ++ .../com/aparapi/codegen/test/MathAbsTest.java | 35 ++ .../com/aparapi/codegen/test/MathDegRad.java | 56 ++ .../aparapi/codegen/test/MathDegRadTest.java | 35 ++ .../aparapi/codegen/test/MathFallThru.java | 65 ++ .../codegen/test/MathFallThruTest.java | 35 ++ .../com/aparapi/codegen/test/MathMax.java | 65 ++ .../com/aparapi/codegen/test/MathMaxTest.java | 35 ++ .../com/aparapi/codegen/test/MathMin.java | 65 ++ .../com/aparapi/codegen/test/MathMinTest.java | 35 ++ .../aparapi/codegen/test/MathRemainder.java | 58 ++ .../codegen/test/MathRemainderTest.java | 35 ++ .../aparapi/codegen/test/MultiContinue.java | 74 +++ .../codegen/test/MultiContinueTest.java | 35 ++ .../aparapi/codegen/test/MultipleAssign.java | 51 ++ .../codegen/test/MultipleAssignExpr.java | 58 ++ .../codegen/test/MultipleAssignExprTest.java | 35 ++ .../codegen/test/MultipleAssignTest.java | 35 ++ .../java/com/aparapi/codegen/test/NaN.java | 48 ++ .../com/aparapi/codegen/test/NaNTest.java | 35 ++ .../aparapi/codegen/test/NewLocalArray.java | 54 ++ .../codegen/test/NewLocalArrayTest.java | 35 ++ .../aparapi/codegen/test/NonNullCheck.java | 52 ++ .../codegen/test/NonNullCheckTest.java | 35 ++ .../com/aparapi/codegen/test/NullCheck.java | 53 ++ .../aparapi/codegen/test/NullCheckTest.java | 35 ++ .../test/ObjectArrayCallHierarchy.java | 85 +++ .../test/ObjectArrayCallHierarchyTest.java | 35 ++ .../codegen/test/ObjectArrayCommonSuper.java | 72 +++ .../test/ObjectArrayCommonSuperTest.java | 35 ++ .../codegen/test/ObjectArrayMemberAccess.java | 111 ++++ .../test/ObjectArrayMemberAccessTest.java | 35 ++ .../test/ObjectArrayMemberBadGetter.java | 56 ++ .../test/ObjectArrayMemberBadGetterTest.java | 35 ++ .../test/ObjectArrayMemberBadSetter.java | 55 ++ .../test/ObjectArrayMemberBadSetterTest.java | 35 ++ .../codegen/test/ObjectArrayMemberCall.java | 124 ++++ .../test/ObjectArrayMemberCallTest.java | 35 ++ .../test/ObjectArrayMemberGetterSetter.java | 234 ++++++++ .../ObjectArrayMemberGetterSetterTest.java | 35 ++ .../test/ObjectArrayMemberHierarchy.java | 128 ++++ .../test/ObjectArrayMemberHierarchyTest.java | 35 ++ .../test/ObjectArrayMemberNotFinal.java | 103 ++++ .../test/ObjectArrayMemberNotFinalTest.java | 35 ++ .../aparapi/codegen/test/ObjectRefCopy.java | 39 ++ .../codegen/test/ObjectRefCopyTest.java | 35 ++ .../codegen/test/ObjectWithinObject.java | 42 ++ .../codegen/test/ObjectWithinObjectTest.java | 35 ++ .../codegen/test/OrAndOrPrecedence.java | 59 ++ .../codegen/test/OrAndOrPrecedenceTest.java | 35 ++ .../aparapi/codegen/test/OverloadMethod.java | 62 ++ .../codegen/test/OverloadMethodTest.java | 35 ++ .../codegen/test/OverriddenKernelField.java | 72 +++ .../test/OverriddenKernelFieldTest.java | 35 ++ .../com/aparapi/codegen/test/PlayPen.java | 73 +++ .../com/aparapi/codegen/test/PlayPenTest.java | 35 ++ .../codegen/test/PostDecArrayItem.java | 61 ++ .../codegen/test/PostDecArrayItemTest.java | 35 ++ .../com/aparapi/codegen/test/PostDecByte.java | 56 ++ .../aparapi/codegen/test/PostDecByteTest.java | 35 ++ .../aparapi/codegen/test/PostDecLocal.java | 52 ++ .../codegen/test/PostDecLocalTest.java | 35 ++ .../aparapi/codegen/test/PostDecPostInc.java | 49 ++ .../codegen/test/PostDecPostIncTest.java | 35 ++ .../test/PostIncArrayIndexAndElement.java | 50 ++ .../test/PostIncArrayIndexAndElementTest.java | 35 ++ .../codegen/test/PostIncArrayItem.java | 61 ++ .../test/PostIncArrayItemAsParameter.java | 63 ++ .../test/PostIncArrayItemAsParameterTest.java | 35 ++ .../test/PostIncArrayItemFieldIndex.java | 60 ++ .../test/PostIncArrayItemFieldIndexTest.java | 35 ++ .../codegen/test/PostIncArrayItemTest.java | 35 ++ .../com/aparapi/codegen/test/PostIncByte.java | 57 ++ .../codegen/test/PostIncByteField.java | 32 + .../codegen/test/PostIncByteFieldTest.java | 35 ++ .../aparapi/codegen/test/PostIncByteTest.java | 35 ++ .../com/aparapi/codegen/test/PostIncInt.java | 54 ++ .../aparapi/codegen/test/PostIncIntField.java | 32 + .../codegen/test/PostIncIntFieldTest.java | 35 ++ .../aparapi/codegen/test/PostIncIntTest.java | 35 ++ .../aparapi/codegen/test/PostIncLocal.java | 52 ++ .../codegen/test/PostIncLocalStandalone.java | 48 ++ .../test/PostIncLocalStandaloneTest.java | 35 ++ .../codegen/test/PostIncLocalTest.java | 35 ++ .../codegen/test/PostIncLocalTwice.java | 52 ++ .../codegen/test/PostIncLocalTwiceTest.java | 35 ++ .../test/PreDecArrayIndexAndElement.java | 50 ++ .../test/PreDecArrayIndexAndElementTest.java | 35 ++ .../aparapi/codegen/test/PreDecArrayItem.java | 58 ++ .../codegen/test/PreDecArrayItemTest.java | 35 ++ .../aparapi/codegen/test/PreDecPostInc.java | 50 ++ .../codegen/test/PreDecPostIncTest.java | 35 ++ .../test/PreIncArrayIndexAndElement.java | 50 ++ .../test/PreIncArrayIndexAndElementTest.java | 35 ++ .../aparapi/codegen/test/PreIncArrayItem.java | 58 ++ .../codegen/test/PreIncArrayItemTest.java | 35 ++ .../com/aparapi/codegen/test/PreIncByte.java | 76 +++ .../aparapi/codegen/test/PreIncByteField.java | 32 + .../codegen/test/PreIncByteFieldTest.java | 35 ++ .../aparapi/codegen/test/PreIncByteTest.java | 35 ++ .../com/aparapi/codegen/test/PreIncInt.java | 56 ++ .../aparapi/codegen/test/PreIncIntField.java | 32 + .../codegen/test/PreIncIntFieldTest.java | 35 ++ .../aparapi/codegen/test/PreIncIntTest.java | 35 ++ .../com/aparapi/codegen/test/PreIncLocal.java | 53 ++ .../codegen/test/PreIncLocalStandalone.java | 48 ++ .../test/PreIncLocalStandaloneTest.java | 35 ++ .../aparapi/codegen/test/PreIncLocalTest.java | 35 ++ .../codegen/test/PreIncLocalTwice.java | 53 ++ .../codegen/test/PreIncLocalTwiceTest.java | 35 ++ .../codegen/test/ReturnBooleanNewArray.java | 29 + .../test/ReturnBooleanNewArrayTest.java | 35 ++ .../codegen/test/ReturnBooleanVarArray.java | 31 + .../test/ReturnBooleanVarArrayTest.java | 35 ++ .../codegen/test/ReturnByteArrayNew.java | 28 + .../codegen/test/ReturnByteArrayNewTest.java | 35 ++ .../codegen/test/ReturnByteArrayVar.java | 30 + .../codegen/test/ReturnByteArrayVarTest.java | 35 ++ .../codegen/test/ReturnDoubleArrayNew.java | 28 + .../test/ReturnDoubleArrayNewTest.java | 35 ++ .../codegen/test/ReturnDoubleArrayVar.java | 30 + .../test/ReturnDoubleArrayVarTest.java | 35 ++ .../codegen/test/ReturnFloatArrayNew.java | 28 + .../codegen/test/ReturnFloatArrayNewTest.java | 35 ++ .../codegen/test/ReturnFloatArrayVar.java | 30 + .../codegen/test/ReturnFloatArrayVarTest.java | 35 ++ .../codegen/test/ReturnIntArrayNew.java | 28 + .../codegen/test/ReturnIntArrayNewTest.java | 35 ++ .../codegen/test/ReturnIntArrayVar.java | 30 + .../codegen/test/ReturnIntArrayVarTest.java | 35 ++ .../codegen/test/ReturnLongArrayNew.java | 28 + .../codegen/test/ReturnLongArrayNewTest.java | 35 ++ .../codegen/test/ReturnLongArrayVar.java | 30 + .../codegen/test/ReturnLongArrayVarTest.java | 35 ++ .../codegen/test/ReturnPostIncInt.java | 50 ++ .../codegen/test/ReturnPostIncIntTest.java | 35 ++ .../aparapi/codegen/test/ReturnPreIncInt.java | 51 ++ .../codegen/test/ReturnPreIncIntTest.java | 35 ++ .../codegen/test/ReturnShortArrayNew.java | 28 + .../codegen/test/ReturnShortArrayNewTest.java | 35 ++ .../codegen/test/ReturnShortArrayVar.java | 30 + .../codegen/test/ReturnShortArrayVarTest.java | 35 ++ .../com/aparapi/codegen/test/RightShifts.java | 61 ++ .../aparapi/codegen/test/RightShiftsTest.java | 35 ++ .../com/aparapi/codegen/test/Sequence.java | 42 ++ .../aparapi/codegen/test/SequenceTest.java | 35 ++ .../codegen/test/StaticFieldStore.java | 26 + .../codegen/test/StaticFieldStoreTest.java | 35 ++ .../codegen/test/StaticMethodCall.java | 57 ++ .../codegen/test/StaticMethodCallTest.java | 35 ++ .../codegen/test/SynchronizedMethods.java | 42 ++ .../codegen/test/SynchronizedMethodsTest.java | 35 ++ .../com/aparapi/codegen/test/Ternary.java | 52 ++ .../com/aparapi/codegen/test/TernaryAnd.java | 50 ++ .../aparapi/codegen/test/TernaryAndOr.java | 49 ++ .../codegen/test/TernaryAndOrTest.java | 35 ++ .../aparapi/codegen/test/TernaryAndTest.java | 35 ++ .../aparapi/codegen/test/TernaryNested.java | 46 ++ .../codegen/test/TernaryNestedTest.java | 35 ++ .../com/aparapi/codegen/test/TernaryOr.java | 51 ++ .../aparapi/codegen/test/TernaryOrTest.java | 35 ++ .../com/aparapi/codegen/test/TernaryTest.java | 35 ++ .../com/aparapi/codegen/test/TwoForLoops.java | 64 ++ .../aparapi/codegen/test/TwoForLoopsTest.java | 35 ++ .../UnrelatedIfElsesWithCommonEndByte.java | 99 ++++ ...UnrelatedIfElsesWithCommonEndByteTest.java | 35 ++ .../test/UnrelatedIfsWithCommonEndByte.java | 82 +++ .../UnrelatedIfsWithCommonEndByteTest.java | 35 ++ .../codegen/test/UnrelatedNestedIfElses.java | 85 +++ .../test/UnrelatedNestedIfElsesTest.java | 35 ++ .../com/aparapi/codegen/test/UseObject.java | 37 ++ .../codegen/test/UseObjectArrayLength.java | 62 ++ .../test/UseObjectArrayLengthTest.java | 35 ++ .../aparapi/codegen/test/UseObjectTest.java | 35 ++ .../aparapi/codegen/test/UsesArrayLength.java | 145 +++++ .../codegen/test/UsesArrayLengthTest.java | 35 ++ .../com/aparapi/codegen/test/UsesNew.java | 27 + .../com/aparapi/codegen/test/UsesNewTest.java | 35 ++ .../com/aparapi/codegen/test/UsesThrow.java | 41 ++ .../aparapi/codegen/test/UsesThrowTest.java | 35 ++ .../aparapi/codegen/test/VarargsForEach.java | 39 ++ .../codegen/test/VarargsForEachTest.java | 35 ++ .../aparapi/codegen/test/VarargsSimple.java | 39 ++ .../codegen/test/VarargsSimpleTest.java | 35 ++ .../java/com/aparapi/codegen/test/While.java | 53 ++ .../aparapi/codegen/test/WhileAndMandel.java | 105 ++++ .../codegen/test/WhileAndMandelTest.java | 35 ++ .../aparapi/codegen/test/WhileEmptyLoop.java | 45 ++ .../codegen/test/WhileEmptyLoopTest.java | 35 ++ .../codegen/test/WhileFloatCompound.java | 64 ++ .../codegen/test/WhileFloatCompoundTest.java | 35 ++ .../com/aparapi/codegen/test/WhileIf.java | 61 ++ .../com/aparapi/codegen/test/WhileIfElse.java | 64 ++ .../aparapi/codegen/test/WhileIfElseTest.java | 35 ++ .../com/aparapi/codegen/test/WhileIfTest.java | 35 ++ .../com/aparapi/codegen/test/WhileTest.java | 35 ++ .../codegen/test/WhileWithoutMutator.java | 45 ++ .../codegen/test/WhileWithoutMutatorTest.java | 35 ++ .../codegen/test/While_If_IfElseElse.java | 131 ++++ .../codegen/test/While_If_IfElseElseTest.java | 35 ++ .../com/aparapi/codegen/test/WideInc.java | 45 ++ .../com/aparapi/codegen/test/WideIncTest.java | 35 ++ .../com/aparapi/codegen/test/WideLoad.java | 558 ++++++++++++++++++ .../aparapi/codegen/test/WideLoadTest.java | 35 ++ .../java/com/aparapi/runtime/LoadClTest.java | 2 +- 441 files changed, 21627 insertions(+), 24 deletions(-) create mode 100644 src/test/java/com/aparapi/codegen/CodeGenJUnitBase.java create mode 100644 src/test/java/com/aparapi/codegen/CreateJUnitTest.java create mode 100644 src/test/java/com/aparapi/codegen/Diff.java create mode 100644 src/test/java/com/aparapi/codegen/KernelHelper.java create mode 100644 src/test/java/com/aparapi/codegen/Source.java create mode 100644 src/test/java/com/aparapi/codegen/SwingDiff.java create mode 100644 src/test/java/com/aparapi/codegen/test/Access2DIntArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/Access2DIntArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessBooleanArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessBooleanArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessByteArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessByteArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessDoubleArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessDoubleArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessFloatArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessFloatArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessIntArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessIntArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessLongArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessLongArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessNested2DIntArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessNested2DIntArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessShortArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/AccessShortArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AndOrAndPrecedence.java create mode 100644 src/test/java/com/aparapi/codegen/test/AndOrAndPrecedenceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AndOrPrecedence.java create mode 100644 src/test/java/com/aparapi/codegen/test/AndOrPrecedence2.java create mode 100644 src/test/java/com/aparapi/codegen/test/AndOrPrecedence2Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/AndOrPrecedenceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArbitraryScope.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArbitraryScope2.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArbitraryScope2Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimple.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimpleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArbitraryScopeTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35.java create mode 100644 src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/Assign2DIntArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/Assign2DIntArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameter.java create mode 100644 src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimple.java create mode 100644 src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimpleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/AssignField.java create mode 100644 src/test/java/com/aparapi/codegen/test/AssignFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Atomic32Pragma.java create mode 100644 src/test/java/com/aparapi/codegen/test/Atomic32PragmaTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/BooleanToggle.java create mode 100644 src/test/java/com/aparapi/codegen/test/BooleanToggleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Break.java create mode 100644 src/test/java/com/aparapi/codegen/test/BreakTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ByteParams.java create mode 100644 src/test/java/com/aparapi/codegen/test/ByteParamsSimple.java create mode 100644 src/test/java/com/aparapi/codegen/test/ByteParamsSimpleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ByteParamsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallGetPassId.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallGetPassIdTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallObject.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallObjectStatic.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallObjectStaticTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallObjectTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallRunSuper.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallRunSuperTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClass.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClassTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallSuper.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallSuperTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallTwice.java create mode 100644 src/test/java/com/aparapi/codegen/test/CallTwiceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CharArrayField.java create mode 100644 src/test/java/com/aparapi/codegen/test/CharArrayFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CharAsParameter.java create mode 100644 src/test/java/com/aparapi/codegen/test/CharAsParameterTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CharType.java create mode 100644 src/test/java/com/aparapi/codegen/test/CharTypeTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccess.java create mode 100644 src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccessTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ClassHasStaticMethod.java create mode 100644 src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimple.java create mode 100644 src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimpleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/CompositeArbitraryScope.java create mode 100644 src/test/java/com/aparapi/codegen/test/CompositeArbitraryScopeTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ConstantAssignInExpression.java create mode 100644 src/test/java/com/aparapi/codegen/test/ConstantAssignInExpressionTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Continue.java create mode 100644 src/test/java/com/aparapi/codegen/test/ContinueTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ContinueTorture.java create mode 100644 src/test/java/com/aparapi/codegen/test/ContinueTortureTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/DirectRecursion.java create mode 100644 src/test/java/com/aparapi/codegen/test/DirectRecursionTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/DoWhile.java create mode 100644 src/test/java/com/aparapi/codegen/test/DoWhileTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Drem.java create mode 100644 src/test/java/com/aparapi/codegen/test/DremTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/EarlyReturn.java create mode 100644 src/test/java/com/aparapi/codegen/test/EarlyReturnTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/EmptyWhileWithInc.java create mode 100644 src/test/java/com/aparapi/codegen/test/EmptyWhileWithIncTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/EntrypointRecursion.java create mode 100644 src/test/java/com/aparapi/codegen/test/EntrypointRecursionTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Ex.java create mode 100644 src/test/java/com/aparapi/codegen/test/ExTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/FirstAssignInExpression.java create mode 100644 src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2.java create mode 100644 src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/FirstAssignInExpressionTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/FloatParams.java create mode 100644 src/test/java/com/aparapi/codegen/test/FloatParamsSimple.java create mode 100644 src/test/java/com/aparapi/codegen/test/FloatParamsSimpleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/FloatParamsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/For.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAndMandel.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitialize.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitializeTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAndMandelTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAsFirst.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForAsFirstTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForBooleanToggle.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForBooleanToggleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForBreak.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForBreakTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForEach.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForEachTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForIf.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForIfMandel.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForIfMandelTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForIfTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ForTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Frem.java create mode 100644 src/test/java/com/aparapi/codegen/test/FremTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IEEERemainderDouble.java create mode 100644 src/test/java/com/aparapi/codegen/test/IEEERemainderDoubleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IEEERemainderFloat.java create mode 100644 src/test/java/com/aparapi/codegen/test/IEEERemainderFloatTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndAndAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndAndAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndOrAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndOrAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseAndAndAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseAndAndAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElse.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseOrOrAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseOrOrAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseOrOrOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseOrOrOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse_And_Or_And.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse_And_Or_AndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse_OrOr_And.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse_OrOr_AndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse_Or_And_Or.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfElse_Or_And_OrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrAndOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrAndOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrOrAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrOrAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrOrOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrOrOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IfTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_Else.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_ElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_IfElse_Else.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_IfElse_ElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_If_Else.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_If_Else2.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_If_Else2Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_If_ElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_If_Else_If_.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_If_Else_If_Test.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_OrOr_And.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_OrOr_AndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_While_Else.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_While_ElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_While_Else_While.java create mode 100644 src/test/java/com/aparapi/codegen/test/If_While_Else_WhileTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ImplementsInterface.java create mode 100644 src/test/java/com/aparapi/codegen/test/ImplementsInterfaceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IncArrayArgContent.java create mode 100644 src/test/java/com/aparapi/codegen/test/IncArrayArgContentTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IncField.java create mode 100644 src/test/java/com/aparapi/codegen/test/IncFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/IndirectRecursion.java create mode 100644 src/test/java/com/aparapi/codegen/test/IndirectRecursionTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Interface.java create mode 100644 src/test/java/com/aparapi/codegen/test/InterfaceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/LongCompare.java create mode 100644 src/test/java/com/aparapi/codegen/test/LongCompareTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/LongCompares.java create mode 100644 src/test/java/com/aparapi/codegen/test/LongComparesTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Loops.java create mode 100644 src/test/java/com/aparapi/codegen/test/LoopsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathAbs.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathAbsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathDegRad.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathDegRadTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathFallThru.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathFallThruTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathMax.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathMaxTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathMin.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathMinTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathRemainder.java create mode 100644 src/test/java/com/aparapi/codegen/test/MathRemainderTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MultiContinue.java create mode 100644 src/test/java/com/aparapi/codegen/test/MultiContinueTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MultipleAssign.java create mode 100644 src/test/java/com/aparapi/codegen/test/MultipleAssignExpr.java create mode 100644 src/test/java/com/aparapi/codegen/test/MultipleAssignExprTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/MultipleAssignTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/NaN.java create mode 100644 src/test/java/com/aparapi/codegen/test/NaNTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/NewLocalArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/NewLocalArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/NonNullCheck.java create mode 100644 src/test/java/com/aparapi/codegen/test/NonNullCheckTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/NullCheck.java create mode 100644 src/test/java/com/aparapi/codegen/test/NullCheckTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchy.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchyTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuper.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuperTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccess.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccessTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetter.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetterTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetter.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetterTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCall.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCallTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetter.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetterTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchy.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchyTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinal.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinalTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectRefCopy.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectRefCopyTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectWithinObject.java create mode 100644 src/test/java/com/aparapi/codegen/test/ObjectWithinObjectTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/OrAndOrPrecedence.java create mode 100644 src/test/java/com/aparapi/codegen/test/OrAndOrPrecedenceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/OverloadMethod.java create mode 100644 src/test/java/com/aparapi/codegen/test/OverloadMethodTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/OverriddenKernelField.java create mode 100644 src/test/java/com/aparapi/codegen/test/OverriddenKernelFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PlayPen.java create mode 100644 src/test/java/com/aparapi/codegen/test/PlayPenTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecArrayItem.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecArrayItemTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecByte.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecByteTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecLocal.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecLocalTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecPostInc.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostDecPostIncTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElement.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElementTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayItem.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameter.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameterTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndex.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndexTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncArrayItemTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncByte.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncByteField.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncByteFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncByteTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncInt.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncIntField.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncIntFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncIntTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncLocal.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncLocalStandalone.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncLocalStandaloneTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncLocalTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncLocalTwice.java create mode 100644 src/test/java/com/aparapi/codegen/test/PostIncLocalTwiceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElement.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElementTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreDecArrayItem.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreDecArrayItemTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreDecPostInc.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreDecPostIncTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElement.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElementTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncArrayItem.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncArrayItemTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncByte.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncByteField.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncByteFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncByteTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncInt.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncIntField.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncIntFieldTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncIntTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncLocal.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncLocalStandalone.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncLocalStandaloneTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncLocalTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncLocalTwice.java create mode 100644 src/test/java/com/aparapi/codegen/test/PreIncLocalTwiceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArray.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArrayTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnByteArrayNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnByteArrayNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnByteArrayVar.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnByteArrayVarTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVar.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVarTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVar.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVarTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnIntArrayNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnIntArrayNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnIntArrayVar.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnIntArrayVarTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnLongArrayNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnLongArrayNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnLongArrayVar.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnLongArrayVarTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnPostIncInt.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnPostIncIntTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnPreIncInt.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnPreIncIntTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnShortArrayNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnShortArrayNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnShortArrayVar.java create mode 100644 src/test/java/com/aparapi/codegen/test/ReturnShortArrayVarTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/RightShifts.java create mode 100644 src/test/java/com/aparapi/codegen/test/RightShiftsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Sequence.java create mode 100644 src/test/java/com/aparapi/codegen/test/SequenceTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/StaticFieldStore.java create mode 100644 src/test/java/com/aparapi/codegen/test/StaticFieldStoreTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/StaticMethodCall.java create mode 100644 src/test/java/com/aparapi/codegen/test/StaticMethodCallTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/SynchronizedMethods.java create mode 100644 src/test/java/com/aparapi/codegen/test/SynchronizedMethodsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/Ternary.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryAnd.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryAndOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryAndOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryAndTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryNested.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryNestedTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryOr.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryOrTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/TernaryTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/TwoForLoops.java create mode 100644 src/test/java/com/aparapi/codegen/test/TwoForLoopsTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByte.java create mode 100644 src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByteTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByte.java create mode 100644 src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByteTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElses.java create mode 100644 src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElsesTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UseObject.java create mode 100644 src/test/java/com/aparapi/codegen/test/UseObjectArrayLength.java create mode 100644 src/test/java/com/aparapi/codegen/test/UseObjectArrayLengthTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UseObjectTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UsesArrayLength.java create mode 100644 src/test/java/com/aparapi/codegen/test/UsesArrayLengthTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UsesNew.java create mode 100644 src/test/java/com/aparapi/codegen/test/UsesNewTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/UsesThrow.java create mode 100644 src/test/java/com/aparapi/codegen/test/UsesThrowTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/VarargsForEach.java create mode 100644 src/test/java/com/aparapi/codegen/test/VarargsForEachTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/VarargsSimple.java create mode 100644 src/test/java/com/aparapi/codegen/test/VarargsSimpleTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/While.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileAndMandel.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileAndMandelTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileEmptyLoop.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileEmptyLoopTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileFloatCompound.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileFloatCompoundTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileIf.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileIfElse.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileIfElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileIfTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileWithoutMutator.java create mode 100644 src/test/java/com/aparapi/codegen/test/WhileWithoutMutatorTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/While_If_IfElseElse.java create mode 100644 src/test/java/com/aparapi/codegen/test/While_If_IfElseElseTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WideInc.java create mode 100644 src/test/java/com/aparapi/codegen/test/WideIncTest.java create mode 100644 src/test/java/com/aparapi/codegen/test/WideLoad.java create mode 100644 src/test/java/com/aparapi/codegen/test/WideLoadTest.java diff --git a/src/main/java/com/aparapi/Config.java b/src/main/java/com/aparapi/Config.java index 6d04663d..06f369a8 100644 --- a/src/main/java/com/aparapi/Config.java +++ b/src/main/java/com/aparapi/Config.java @@ -78,7 +78,7 @@ public class Config extends ConfigJNI{ * Allows the user to request to use a jvmti agent to * access JNI code rather than loading explicitly. * - * Usage -agentpath=/full/path/to/agent.dll -Dcom.aparapi.useAgent=true + * Usage -agentpath=/full/path/to/agent.dll -Dcom.codegen.useAgent=true */ public static final boolean useAgent = Boolean.getBoolean(propPkgName + ".useAgent"); @@ -91,7 +91,7 @@ public class Config extends ConfigJNI{ /** * Allows the user to request a specific Kernel.EXECUTION_MODE enum value for all Kernels. * - * Usage -Dcom.aparapi.executionMode={SEQ|JTP|CPU|GPU|ACC} + * Usage -Dcom.codegen.executionMode={SEQ|JTP|CPU|GPU|ACC} * * @see com.aparapi.Kernel.EXECUTION_MODE */ @@ -100,7 +100,7 @@ public class Config extends ConfigJNI{ /** * Allows the user to request that the execution mode of each kernel invocation be reported to stdout. * - * Usage -Dcom.aparapi.enableExecutionModeReporting={true|false} + * Usage -Dcom.codegen.enableExecutionModeReporting={true|false} * */ public static final boolean enableExecutionModeReporting = Boolean.getBoolean(propPkgName + ".enableExecutionModeReporting"); @@ -108,7 +108,7 @@ public class Config extends ConfigJNI{ /** * Allows the user to request that generated OpenCL code is dumped to standard out. * - * Usage -Dcom.aparapi.enableShowGeneratedOpenCL={true|false} + * Usage -Dcom.codegen.enableShowGeneratedOpenCL={true|false} * */ public static final boolean enableShowGeneratedOpenCL = Boolean.getBoolean(propPkgName + ".enableShowGeneratedOpenCL"); @@ -116,7 +116,7 @@ public class Config extends ConfigJNI{ /** * Upon exiting the JVM, dumps kernel profiling info to standard out. * - * Usage -Dcom.aparapi.dumpProfilesOnExit={true|false} + * Usage -Dcom.codegen.dumpProfilesOnExit={true|false} * */ public static final boolean dumpProfilesOnExit = Boolean.getBoolean(propPkgName + ".dumpProfilesOnExit"); @@ -124,7 +124,7 @@ public class Config extends ConfigJNI{ /** * Dumps profiling info (for a single execution) after every Kernel execution. * - * Usage -Dcom.aparapi.dumpProfileOnExecution={true|false} + * Usage -Dcom.codegen.dumpProfileOnExecution={true|false} * */ public static final boolean dumpProfileOnExecution = Boolean.getBoolean(propPkgName + ".dumpProfileOnExecution"); @@ -228,7 +228,7 @@ public class Config extends ConfigJNI{ System.out.println(propPkgName + ".enableExecutionModeReporting{true|false}=" + enableExecutionModeReporting); System.out.println(propPkgName + ".enableInstructionDecodeViewer{true|false}=" + enableInstructionDecodeViewer); System.out.println(propPkgName - + ".instructionListenerClassName{<class name which extends com.aparapi.Config.InstructionListener>}=" + + ".instructionListenerClassName{<class name which extends com.codegen.Config.InstructionListener>}=" + instructionListenerClassName); } } diff --git a/src/main/java/com/aparapi/Kernel.java b/src/main/java/com/aparapi/Kernel.java index a735cb50..a4a49e43 100644 --- a/src/main/java/com/aparapi/Kernel.java +++ b/src/main/java/com/aparapi/Kernel.java @@ -373,17 +373,17 @@ public abstract class Kernel implements Cloneable { * kernel.execute(values.length); * </pre></blockquote> * <p> -<<<<<<< HEAD:src/main/java/com/aparapi/Kernel.java - * Alternatively, the property <code>com.aparapi.executionMode</code> can be set to one of <code>JTP,GPU,ACC,CPU,SEQ</code> +<<<<<<< HEAD:src/main/java/com/codegen/Kernel.java + * Alternatively, the property <code>com.codegen.executionMode</code> can be set to one of <code>JTP,GPU,ACC,CPU,SEQ</code> * when an application is launched. * <p><blockquote><pre> - * java -classpath ....;aparapi.jar -Dcom.aparapi.executionMode=GPU MyApplication + * java -classpath ....;codegen.jar -Dcom.codegen.executionMode=GPU MyApplication ======= - * Alternatively, the property <code>com.amd.aparapi.executionMode</code> can be set to one of <code>JTP,GPU,ACC,CPU,SEQ</code> + * Alternatively, the property <code>com.amd.codegen.executionMode</code> can be set to one of <code>JTP,GPU,ACC,CPU,SEQ</code> * when an application is launched. * <p><blockquote><pre> - * java -classpath ....;aparapi.jar -Dcom.amd.aparapi.executionMode=GPU MyApplication ->>>>>>> b118aad... added method to set execution mode without any fallback:com.amd.aparapi/src/java/com/amd/aparapi/Kernel.java + * java -classpath ....;codegen.jar -Dcom.amd.codegen.executionMode=GPU MyApplication +>>>>>>> b118aad... added method to set execution mode without any fallback:com.amd.codegen/src/java/com/amd/codegen/Kernel.java * </pre></blockquote><p> * Generally setting the execution mode is not recommended (it is best to let Aparapi decide automatically) but the option * provides a way to compare a kernel's performance under multiple execution modes. diff --git a/src/main/java/com/aparapi/internal/jni/ConfigJNI.java b/src/main/java/com/aparapi/internal/jni/ConfigJNI.java index 91f4ab44..78050b0b 100644 --- a/src/main/java/com/aparapi/internal/jni/ConfigJNI.java +++ b/src/main/java/com/aparapi/internal/jni/ConfigJNI.java @@ -24,14 +24,14 @@ import com.aparapi.internal.annotation.UsedByJNICode; public abstract class ConfigJNI{ /** - * Value defaults to com.aparapi.config if not overridden by extending classes + * Value defaults to com.codegen.config if not overridden by extending classes */ protected static final String propPkgName = Config.class.getPackage().getName(); /** * Allows the user to turn on OpenCL profiling for the JNI/OpenCL layer. * - * Usage -Dcom.aparapi.enableProfiling={true|false} + * Usage -Dcom.codegen.enableProfiling={true|false} * */ @UsedByJNICode public static final boolean enableProfiling = Boolean.getBoolean(propPkgName + ".enableProfiling"); @@ -39,7 +39,7 @@ public abstract class ConfigJNI{ /** * Allows the user to turn on OpenCL profiling for the JNI/OpenCL layer, this information will be written to CSV file * - * Usage -Dcom.aparapi.enableProfiling={true|false} + * Usage -Dcom.codegen.enableProfiling={true|false} * */ @UsedByJNICode public static final boolean enableProfilingCSV = Boolean.getBoolean(propPkgName + ".enableProfilingCSV"); @@ -47,7 +47,7 @@ public abstract class ConfigJNI{ /** * Allows the user to request that verbose JNI messages be dumped to stderr. * - * Usage -Dcom.aparapi.enableVerboseJNI={true|false} + * Usage -Dcom.codegen.enableVerboseJNI={true|false} * */ @UsedByJNICode public static final boolean enableVerboseJNI = Boolean.getBoolean(propPkgName + ".enableVerboseJNI"); @@ -57,7 +57,7 @@ public abstract class ConfigJNI{ * * This is really a debugging option to help locate leaking OpenCL resources, this will be dumped to stderr. * - * Usage -Dcom.aparapi.enableOpenCLResourceTracking={true|false} + * Usage -Dcom.codegen.enableOpenCLResourceTracking={true|false} * */ @UsedByJNICode public static final boolean enableVerboseJNIOpenCLResourceTracking = Boolean.getBoolean(propPkgName diff --git a/src/main/java/com/aparapi/internal/jni/KernelArgJNI.java b/src/main/java/com/aparapi/internal/jni/KernelArgJNI.java index 863e89be..23543349 100644 --- a/src/main/java/com/aparapi/internal/jni/KernelArgJNI.java +++ b/src/main/java/com/aparapi/internal/jni/KernelArgJNI.java @@ -60,7 +60,7 @@ public abstract class KernelArgJNI{ @UsedByJNICode protected Object javaArray; /** - * If this field represents an aparapi buffer then the instance will be captured here + * If this field represents an codegen buffer then the instance will be captured here */ @UsedByJNICode protected Object javaBuffer; diff --git a/src/main/java/com/aparapi/internal/model/Entrypoint.java b/src/main/java/com/aparapi/internal/model/Entrypoint.java index c956816f..3a291b24 100644 --- a/src/main/java/com/aparapi/internal/model/Entrypoint.java +++ b/src/main/java/com/aparapi/internal/model/Entrypoint.java @@ -602,7 +602,7 @@ public class Entrypoint implements Cloneable { // Add the class model for the referenced obj array if (signature.startsWith("[L")) { - // Turn [Lcom/aparapi/javalabs/opencl/demo/DummyOOA; into com.aparapi.javalabs.opencl.demo.DummyOOA for example + // Turn [Lcom/codegen/javalabs/opencl/demo/DummyOOA; into com.codegen.javalabs.opencl.demo.DummyOOA for example final String className = (signature.substring(2, signature.length() - 1)).replace('/', '.'); final ClassModel arrayFieldModel = getOrUpdateAllClassAccesses(className); if (arrayFieldModel != null) { diff --git a/src/main/java/com/aparapi/internal/model/MethodModel.java b/src/main/java/com/aparapi/internal/model/MethodModel.java index da7702f9..4a16a868 100644 --- a/src/main/java/com/aparapi/internal/model/MethodModel.java +++ b/src/main/java/com/aparapi/internal/model/MethodModel.java @@ -1648,7 +1648,7 @@ public class MethodModel{ logger.warning("Method " + method.getName() + method.getDescriptor() - + " does not contain a LocalVariableTable entry (source not compiled with -g) aparapi will attempt to create a synthetic table based on bytecode. This is experimental!!"); + + " does not contain a LocalVariableTable entry (source not compiled with -g) codegen will attempt to create a synthetic table based on bytecode. This is experimental!!"); } // pass #2 build branch graph diff --git a/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java b/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java index 948530a7..78246cc2 100644 --- a/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java +++ b/src/main/java/com/aparapi/internal/opencl/OpenCLLoader.java @@ -45,7 +45,7 @@ public class OpenCLLoader extends OpenCLJNI{ openCLAvailable = true; } catch (final IOException e) { - logger.log(Level.SEVERE, "Check your environment. Failed to load aparapi native library " + logger.log(Level.SEVERE, "Check your environment. Failed to load codegen native library " + " or possibly failed to locate opencl native library (opencl.dll/opencl.so)." + " Ensure that OpenCL is in your PATH (windows) or in LD_LIBRARY_PATH (linux)."); } diff --git a/src/main/java/com/aparapi/internal/writer/KernelWriter.java b/src/main/java/com/aparapi/internal/writer/KernelWriter.java index 17c37e58..4e5de609 100644 --- a/src/main/java/com/aparapi/internal/writer/KernelWriter.java +++ b/src/main/java/com/aparapi/internal/writer/KernelWriter.java @@ -365,7 +365,7 @@ public abstract class KernelWriter extends BlockWriter{ // If it is a converted array of objects, emit the struct param String className = null; if (signature.startsWith("L")) { - // Turn Lcom/aparapi/javalabs/opencl/demo/DummyOOA; into com_amd_javalabs_opencl_demo_DummyOOA for example + // Turn Lcom/codegen/javalabs/opencl/demo/DummyOOA; into com_amd_javalabs_opencl_demo_DummyOOA for example className = (signature.substring(1, signature.length() - 1)).replace('/', '_'); // if (logger.isLoggable(Level.FINE)) { // logger.fine("Examining object parameter: " + signature + " new: " + className); diff --git a/src/test/java/com/aparapi/codegen/CodeGenJUnitBase.java b/src/test/java/com/aparapi/codegen/CodeGenJUnitBase.java new file mode 100644 index 00000000..0fee2c06 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/CodeGenJUnitBase.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +Copyright (c) 2010-2011, Advanced Micro Devices, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export +laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through +774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, +you hereby certify that, except pursuant to a license granted by the United States Department of Commerce Bureau of +Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export Administration +Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in Country Groups D:1, +E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups +D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced direct product is subject +to national security controls as identified on the Commerce Control List (currently found in Supplement 1 to Part 774 +of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations +under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. + +*/ +package com.aparapi.codegen; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import com.aparapi.Kernel; +import com.aparapi.internal.exception.AparapiException; +import com.aparapi.internal.model.ClassModel; +import com.aparapi.internal.model.Entrypoint; +import com.aparapi.internal.writer.KernelWriter; + +public class CodeGenJUnitBase { + + protected void test(Class<?> _class, Class<? extends AparapiException> _expectedExceptionType, String[] expectedOpenCL) { + try { + // Source source = new Source(_class, new File("src/java")); + // System.out.println("opencl\n"+source.getOpenCL()); + + // String expected = source.getOpenCLString(); + + ClassModel classModel = ClassModel.createClassModel(_class); + + // construct an artficial instance of our class here + // we assume the specified class will have a null constructor + Object kernelInstance = _class.getConstructor((Class<?>[]) null).newInstance(); + + Entrypoint entrypoint = classModel.getEntrypoint("run", kernelInstance instanceof Kernel ? kernelInstance : null); + String actual = KernelWriter.writeToString(entrypoint); + + if (_expectedExceptionType == null) { + int matched = 0; + if( expectedOpenCL != null ) { + for (String expected : expectedOpenCL) { + if (Diff.same(actual, expected)) { + break; + } + matched++; + } + } + boolean same = (matched < ( expectedOpenCL != null ? expectedOpenCL.length : 0)); + + if (!same) { + System.out.println("---" + _class.getName() + + "------------------------------------------------------------------------------"); + boolean first = true; + if( expectedOpenCL != null ) { + for (String expected : expectedOpenCL) { + if (first) { + first = false; + } else { + System.out.println("}"); + } + System.out.println("Expected {\n" + expected); + } + } + System.out.println("}Actual\n{" + actual); + System.out + .println("}\n------------------------------------------------------------------------------------------------------"); + + } + if (!same) { + assertEquals(_class.getSimpleName(), Arrays.toString(expectedOpenCL), actual); + } + } else { + assertTrue("Expected exception " + _expectedExceptionType + " Instead we got {\n" + actual + "\n}", false); + } + + } catch (AssertionError e) { + throw e; + } catch (Throwable t) { + if (_expectedExceptionType == null || !t.getClass().isAssignableFrom(_expectedExceptionType)) { + t.printStackTrace(); + throw new AssertionError("Unexpected exception " + t, t); + } + } + } + + protected void test(Class<?> _class, String[] expectedOpenCL) { + test(_class, null, expectedOpenCL); + + } + +} diff --git a/src/test/java/com/aparapi/codegen/CreateJUnitTest.java b/src/test/java/com/aparapi/codegen/CreateJUnitTest.java new file mode 100644 index 00000000..070ce8bc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/CreateJUnitTest.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +Copyright (c) 2010-2011, Advanced Micro Devices, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export +laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through +774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, +you hereby certify that, except pursuant to a license granted by the United States Department of Commerce Bureau of +Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export Administration +Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in Country Groups D:1, +E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups +D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced direct product is subject +to national security controls as identified on the Commerce Control List (currently found in Supplement 1 to Part 774 +of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations +under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. + +*/ +package com.aparapi.codegen; + +import org.junit.Ignore; +import org.junit.Test; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; + +public class CreateJUnitTest { + @Ignore("We will probably never use this, it just generates test. We probably want to do this by hand.") + @Test + public void test() throws ClassNotFoundException, FileNotFoundException, IOException { + File rootDir = new File(System.getProperty("root", ".")); + + String rootPackageName = CreateJUnitTest.class.getPackage().getName(); + String testPackageName = rootPackageName + ".test"; + File sourceDir = new File(rootDir, "src/test/java"); + System.out.println(sourceDir.getCanonicalPath()); + File testDir = new File(sourceDir, testPackageName.replace(".", "/")); + System.out.println(testDir.getCanonicalPath()); + + List<String> classNames = new ArrayList<String>(); + for (File sourceFile : testDir.listFiles(new FilenameFilter() { + + @Override + public boolean accept(File dir, String name) { + return (name.endsWith(".java")); + } + })) { + String fileName = sourceFile.getName(); + String className = fileName.substring(0, fileName.length() - ".java".length()); + classNames.add(className); + } + + File genSourceDir = new File(rootDir, "src/genjava"); + File codeGenDir = new File(genSourceDir, rootPackageName.replace(".", "/") + "/test/junit/codegen/"); + codeGenDir.mkdirs(); + + for (String className : classNames) { + + Source source = new Source(Class.forName(testPackageName + "." + className), sourceDir); + + final String testName = className + "Test"; + + StringBuilder sb = new StringBuilder(); + sb.append("package com.codegen.test.junit.codegen;\n"); + sb.append("import org.junit.Test;\n"); + String doc = source.getDocString(); + if (doc.length() > 0) { + sb.append("/**\n"); + sb.append(doc); + sb.append("\n */\n"); + } + sb.append("public class " + testName + " extends com.codegen.CodeGenJUnitBase{\n"); + appendExpectedOpenCL(source, sb); + appendExpectedExceptions(source, sb); + appendTest(testPackageName, testName, "", sb); + appendTest(testPackageName, testName, "WorksWithCaching", sb); + sb.append("}\n"); + // System.out.println(sb.toString()); + + File generatedFile = new File(codeGenDir, testName + ".java"); + PrintStream out = new PrintStream(generatedFile); + out.append(sb.toString()); + out.close(); + + } + + } + + private static void appendTest(String testPackageName, String className, String suffix, StringBuilder sb) { + sb.append(" @Test public void " + className + suffix + "(){\n"); + sb.append(" test(" + testPackageName + "." + className + ".class, expectedException, expectedOpenCL);\n"); + sb.append(" }\n"); + } + + private static void appendExpectedExceptions(Source source, StringBuilder sb) { + String exceptions = source.getExceptionsString(); + if (exceptions.length() > 0) { + sb.append(" private static final Class<? extends com.codegen.internal.exception.AparapiException> expectedException = "); + + sb.append("com.codegen.internal.exception." + exceptions + ".class"); + sb.append(";\n"); + } else { + sb.append(" private static final Class<? extends com.codegen.internal.exception.AparapiException> expectedException = null;\n"); + } + } + + private static void appendExpectedOpenCL(Source source, StringBuilder sb) { + if (source.getOpenCLSectionCount() > 0) { + + sb.append(" private static final String[] expectedOpenCL = new String[]{\n"); + for (List<String> opencl : source.getOpenCL()) { + sb.append(" \"\"\n"); + for (String line : opencl) { + sb.append(" +\"" + line + "\\n\"\n"); + } + sb.append(" ,\n"); + } + sb.append(" };\n"); + } else { + sb.append(" private static final String[] expectedOpenCL = null;\n"); + } + } +} diff --git a/src/test/java/com/aparapi/codegen/Diff.java b/src/test/java/com/aparapi/codegen/Diff.java new file mode 100644 index 00000000..5a48f633 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/Diff.java @@ -0,0 +1,282 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +Copyright (c) 2010-2011, Advanced Micro Devices, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export +laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through +774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, +you hereby certify that, except pursuant to a license granted by the United States Department of Commerce Bureau of +Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export Administration +Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in Country Groups D:1, +E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups +D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced direct product is subject +to national security controls as identified on the Commerce Control List (currently found in Supplement 1 to Part 774 +of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations +under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. + +*/ +package com.aparapi.codegen; + +import java.awt.Point; +import java.util.ArrayList; +import java.util.List; + +public class Diff{ + + static int[] hash(String[] lines) { + int[] val = new int[lines.length]; + for (int i = 0; i < lines.length; i++) { + val[i] = lines[i].hashCode(); + } + return (val); + } + + static void costDiag(List<Point>[][] flags, int x, int y) { + if (x == 0 || y == 0 || flags[x - 1][y - 1] == null) { + if (x < (flags.length - 2) && y < (flags[0].length - 2)) { + flags[x][y] = new ArrayList<Point>(); + flags[x][y].add(new Point(x, y)); + } + } else { + flags[x - 1][y - 1].add(new Point(x, y)); + flags[x][y] = flags[x - 1][y - 1]; + } + } + + static void cleanIslands(List<Point>[][] flags, int x, int y) { + flags[x][y] = null; + if (x > 0 && y > 0 && flags[x - 1][y - 1] != null && flags[x - 1][y - 1].size() == 1) { + flags[x - 1][y - 1] = null; + } + } + + public static class DiffResult{ + + public static enum TYPE { + SAME, + LEFT, + RIGHT + }; + + public static class Block{ + int lhsFrom; + + int rhsFrom; + + int lhsTo; + + int rhsTo; + + TYPE type; + + public Block(TYPE _type, int _lhsFrom, int _rhsFrom) { + lhsFrom = lhsTo = _lhsFrom; + rhsFrom = rhsTo = _rhsFrom; + type = _type; + } + + public void extend(int _lhsTo, int _rhsTo) { + lhsTo = _lhsTo; + rhsTo = _rhsTo; + } + + public String toString(String[] _lhs, String[] _rhs) { + StringBuilder sb = new StringBuilder(); + sb.append(type).append("\n"); + + switch (type) { + case SAME: + for (int i = lhsFrom; i <= lhsTo; i++) { + sb.append(" ==" + _lhs[i]).append("\n"); + } + break; + case LEFT: + for (int i = lhsFrom; i <= lhsTo; i++) { + sb.append(" <" + _lhs[i]).append("\n"); + } + break; + case RIGHT: + for (int i = rhsFrom; i <= rhsTo; i++) { + sb.append(" >" + _rhs[i]).append("\n"); + } + break; + } + return (sb.toString()); + } + + } + + List<Block> blocks = new ArrayList<Block>(); + + private String[] rhs; + + private String[] lhs; + + public void add(TYPE _type, int lhs, int rhs) { + if (false) { + if (blocks.size() > 0) { + Block lastBlock = blocks.get(blocks.size() - 1); + if (lastBlock.type == _type) { + lastBlock.extend(lhs, rhs); + } else { + blocks.add(new Block(_type, lhs, rhs)); + } + } else { + blocks.add(new Block(_type, lhs, rhs)); + } + } + blocks.add(new Block(_type, lhs, rhs)); + } + + DiffResult(String[] _lhs, String[] _rhs) { + lhs = _lhs; + rhs = _rhs; + } + + public String[] getLhs() { + return lhs; + } + + public String[] getRhs() { + return rhs; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + for (Block block : blocks) { + sb.append(block.toString(lhs, rhs)).append("\n"); + } + return (sb.toString()); + } + } + + @SuppressWarnings("unchecked") public static DiffResult diff(String[] lhsString, String[] rhsString) { + DiffResult diffResult = new DiffResult(lhsString, rhsString); + int[] lhsHash = hash(lhsString); + int[] rhsHash = hash(rhsString); + int lhsLength = lhsHash.length; // number of lines of first file + int rhsLength = rhsHash.length; // number of lines of second file + + // opt[i][j] = length of LCS of x[i..M] and y[j..N] + int[][] opt = new int[lhsLength + 1][rhsLength + 1]; + List<Point>[][] flags = new ArrayList[lhsLength + 1][rhsLength + 1]; + + // compute length of LCS and all subproblems via dynamic programming + for (int i = 0; i < lhsLength; i++) { + for (int j = 0; j < rhsLength; j++) { + if (lhsHash[i] == rhsHash[j]) { + // We are the same so continue the diagonal is intact + if (i == 0 || j == 0) { + opt[i][j] = 0; + } else { + opt[i][j] = opt[i - 1][j - 1] + 1; + } + costDiag(flags, i, j); + } else { + cleanIslands(flags, i, j); + if (i == 0 || j == 0) { + opt[i][j] = 0; + } else { + opt[i][j] = Math.max(opt[i - 1][j], opt[i][j - 1]); + } + } + } + } + + // recover LCS itself and print out non-matching lines to standard output + int i = 0, j = 0; + while (i < lhsLength && j < rhsLength) { + // if the diagonal is in tact walk it + if (lhsHash[i] == rhsHash[j]) { + diffResult.add(DiffResult.TYPE.SAME, i, j); + i++; + j++; + } + // otherwise walk along the xx or y axis which is the longer + // this is not always the best approach. + // we need to find the shortest path between {i,j} and the {i+ii,j+jj} which + // connects us to the next diagonal run + else if (opt[i + 1][j] >= opt[i][j + 1]) { + diffResult.add(DiffResult.TYPE.LEFT, i, j); + System.out.println("lhs:" + i + "< " + lhsString[i++]); + } else { + diffResult.add(DiffResult.TYPE.RIGHT, i, j); + System.out.println("rhs:" + j + "> " + rhsString[j++]); + } + } + + // dump out one remainder of one string if the other is exhausted + while (i < lhsLength || j < rhsLength) { + if (i == lhsLength) { + diffResult.add(DiffResult.TYPE.RIGHT, i, j); + System.out.println("lhs:" + i + "> " + rhsString[j++]); + } else if (j == rhsLength) { + diffResult.add(DiffResult.TYPE.LEFT, i, j); + System.out.println("rhs:" + j + "< " + lhsString[i++]); + } + } + return (diffResult); + } + + public static boolean same(String left, String right) { + StringBuilder leftAll = new StringBuilder(); + + for (String s : left.replace("\n", "").split(" *")) { + leftAll.append(s); + } + + StringBuilder rightAll = new StringBuilder(); + for (String s : right.replace("\n", " ").split(" *")) { + rightAll.append(s); + } + boolean same = leftAll.toString().equals(rightAll.toString()); + if (!same) { + String[] lhs = left.split("\n"); + for (int i = 0; i < lhs.length; i++) { + lhs[i] = lhs[i].trim(); + } + String[] rhs = right.split("\n"); + for (int i = 0; i < rhs.length; i++) { + rhs[i] = rhs[i].trim(); + } + diff(lhs, rhs); + } + return (same); + } + +} diff --git a/src/test/java/com/aparapi/codegen/KernelHelper.java b/src/test/java/com/aparapi/codegen/KernelHelper.java new file mode 100644 index 00000000..a50599a2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/KernelHelper.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +Copyright (c) 2010-2011, Advanced Micro Devices, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export +laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through +774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, +you hereby certify that, except pursuant to a license granted by the United States Department of Commerce Bureau of +Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export Administration +Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in Country Groups D:1, +E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups +D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced direct product is subject +to national security controls as identified on the Commerce Control List (currently found in Supplement 1 to Part 774 +of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations +under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. + +*/ +package com.aparapi.codegen; + +// contains some things that only tests would use +// but in the com.codegen package for convenience + +public class KernelHelper{ + // public KernelHelper(Kernel kernel) { + // this.kernel = kernel; + // this.kernelRunner = kernel.getKernelRunner(); + // } + // + // public boolean hasFP64Support() { + // return kernelRunner.hasFP64Support(); + // } + // + // Kernel kernel; + // + // KernelRunner kernelRunner; +} diff --git a/src/test/java/com/aparapi/codegen/Source.java b/src/test/java/com/aparapi/codegen/Source.java new file mode 100644 index 00000000..c5b44d13 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/Source.java @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +Copyright (c) 2010-2011, Advanced Micro Devices, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export +laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through +774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, +you hereby certify that, except pursuant to a license granted by the United States Department of Commerce Bureau of +Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export Administration +Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in Country Groups D:1, +E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups +D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced direct product is subject +to national security controls as identified on the Commerce Control List (currently found in Supplement 1 to Part 774 +of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations +under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. + +*/ +package com.aparapi.codegen; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +public class Source{ + enum STATE { + NONE, + JAVA, + OPENCL, + DOC + }; + + static final String OpenCLStart = "/**{OpenCL{"; + + static final String OpenCLEnd = "}OpenCL}**/"; + + static final String ThrowsStart = "/**{Throws{"; + + static final String ThrowsEnd = "}Throws}**/"; + + static final String DocStart = "/**"; + + static final String DocEnd = "*/"; + + Class<?> clazz; + + File file; + + Source.STATE state = STATE.NONE; + + List<String> all = new ArrayList<String>(); + + List<List<String>> opencl = new ArrayList<List<String>>(); + + List<String> doc = new ArrayList<String>(); + + List<String> java = new ArrayList<String>(); + + List<String> exceptions = new ArrayList<String>(); + + public Source(Class<?> _clazz, File _rootDir) { + clazz = _clazz; + String srcName = clazz.getPackage().getName().replace(".", "/") + "/" + clazz + ".java"; + file = new File(_rootDir, srcName); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + + state = STATE.JAVA; + List<String> openclSection = null; + for (String line = reader.readLine(); line != null; line = reader.readLine()) { + all.add(line); + String trimmedLine = line.trim(); + switch (state) { + case JAVA: + if (trimmedLine.equals(OpenCLStart)) { + state = STATE.OPENCL; + openclSection = new ArrayList<String>(); + opencl.add(openclSection); + + } else if (trimmedLine.startsWith(ThrowsStart) && trimmedLine.endsWith(ThrowsEnd)) { + exceptions.add(trimmedLine.substring(ThrowsStart.length(), trimmedLine.length() - ThrowsEnd.length())); + } else if (trimmedLine.equals(DocStart)) { + state = STATE.DOC; + } else { + java.add(line); + } + break; + case OPENCL: + if (trimmedLine.equals(OpenCLEnd)) { + state = STATE.JAVA; + } else { + openclSection.add(line); + } + break; + case DOC: + if (trimmedLine.equals(DocEnd)) { + state = STATE.JAVA; + } else { + doc.add(line); + } + break; + + } + } + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private String listToString(List<String> list) { + StringBuilder stringBuilder = new StringBuilder(); + for (String line : list) { + stringBuilder.append(line).append("\n"); + } + return (stringBuilder.toString().trim()); + } + + public String getOpenCLString(int _index) { + return (listToString(opencl.get(_index))); + } + + public List<List<String>> getOpenCL() { + return (opencl); + } + + public String getJavaString() { + return (listToString(java)); + } + + public List<String> getJava() { + return (java); + } + + public File getFile() { + return (file); + } + + public String getExceptionsString() { + return (listToString(exceptions)); + } + + public List<String> getExceptions() { + return (exceptions); + } + + public String getDocString() { + return (listToString(doc)); + } + + public List<String> getDoc() { + return (doc); + } + + public int getOpenCLSectionCount() { + return (opencl.size()); + } +} diff --git a/src/test/java/com/aparapi/codegen/SwingDiff.java b/src/test/java/com/aparapi/codegen/SwingDiff.java new file mode 100644 index 00000000..0b431359 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/SwingDiff.java @@ -0,0 +1,216 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +Copyright (c) 2010-2011, Advanced Micro Devices, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +If you use the software (in whole or in part), you shall adhere to all applicable U.S., European, and other export +laws, including but not limited to the U.S. Export Administration Regulations ("EAR"), (15 C.F.R. Sections 730 through +774), and E.U. Council Regulation (EC) No 1334/2000 of 22 June 2000. Further, pursuant to Section 740.6 of the EAR, +you hereby certify that, except pursuant to a license granted by the United States Department of Commerce Bureau of +Industry and Security or as otherwise permitted pursuant to a License Exception under the U.S. Export Administration +Regulations ("EAR"), you will not (1) export, re-export or release to a national of a country in Country Groups D:1, +E:1 or E:2 any restricted technology, software, or source code you receive hereunder, or (2) export to Country Groups +D:1, E:1 or E:2 the direct product of such technology or software, if such foreign produced direct product is subject +to national security controls as identified on the Commerce Control List (currently found in Supplement 1 to Part 774 +of EAR). For the most current Country Group listings, or for additional information about the EAR or your obligations +under those regulations, please refer to the U.S. Bureau of Industry and Security's website at http://www.bis.doc.gov/. + +*/ +package com.aparapi.codegen; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.text.Style; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; + +public class SwingDiff{ + JFrame frame; + + public SwingDiff(Diff.DiffResult result) { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + frame = new JFrame("SwingDiff"); + + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + JPanel panel = new JPanel(){ + @Override public void paint(Graphics g) { + super.paint(g); + g.drawRect(10, 10, 100, 100); + } + }; + panel.setLayout(new BorderLayout()); + + StyleContext sc = new StyleContext(); + + // Create and add the style + final Style rootStyle = sc.addStyle("Root", null); + rootStyle.addAttribute(StyleConstants.Foreground, Color.black); + rootStyle.addAttribute(StyleConstants.FontSize, new Integer(12)); + rootStyle.addAttribute(StyleConstants.FontFamily, "serif"); + rootStyle.addAttribute(StyleConstants.Bold, new Boolean(false)); + final Style heading1Style = sc.addStyle("Heading1", rootStyle); + heading1Style.addAttribute(StyleConstants.Foreground, Color.blue); + + final Style heading2Style = sc.addStyle("Heading2", rootStyle); + heading2Style.addAttribute(StyleConstants.Foreground, Color.red); + heading2Style.addAttribute(StyleConstants.Background, Color.green); + + final DefaultStyledDocument lhsdoc = new DefaultStyledDocument(sc); + JTextPane lhs = new JTextPane(lhsdoc); + + lhsdoc.insertString(0, arrayToString(result.getLhs()), null); + + // Finally, apply the style to the heading + + lhsdoc.setParagraphAttributes(4, 1, heading2Style, false); + lhsdoc.setParagraphAttributes(20, 5, heading1Style, false); + + lhs.setPreferredSize(new Dimension(800, 800)); + final DefaultStyledDocument rhsdoc = new DefaultStyledDocument(sc); + JTextPane rhs = new JTextPane(rhsdoc); + rhsdoc.insertString(0, arrayToString(result.getRhs()), null); + + rhsdoc.setParagraphAttributes(4, 1, heading2Style, false); + rhsdoc.setParagraphAttributes(20, 5, heading1Style, false); + rhs.setPreferredSize(new Dimension(800, 800)); + panel.add(new JScrollPane(lhs), BorderLayout.WEST); + panel.add(new JScrollPane(rhs), BorderLayout.EAST); + + // frame.setBackground(background); + frame.getContentPane().add(panel); + frame.pack(); + frame.setVisible(true); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BadLocationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + String[] lhs = getFileContents("expected.c"); + String[] rhs = getFileContents("actual.c"); + + Diff.DiffResult result = Diff.diff(lhs, rhs); + System.out.println(result); + + SwingDiff swingDiff = new SwingDiff(result); + } + + private static String arrayToString(String[] array) { + StringBuilder stringBuilder = new StringBuilder(); + for (String line : array) { + stringBuilder.append(line).append("\n"); + } + return (stringBuilder.toString().trim()); + } + + private static String[] getFileContents(String string) { + String[] content = null; + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(string))); + List<String> lines = new ArrayList<String>(); + for (String line = reader.readLine(); line != null; line = reader.readLine()) { + lines.add(line); + } + reader.close(); + content = lines.toArray(new String[0]); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return (content); + + } + + private static String getFileContent(String string) { + String content = null; + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(string))); + StringBuilder sb = new StringBuilder(); + for (String line = reader.readLine(); line != null; line = reader.readLine()) { + sb.append(line).append("\n"); + } + reader.close(); + content = sb.toString(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return (content); + + } + +} diff --git a/src/test/java/com/aparapi/codegen/test/Access2DIntArray.java b/src/test/java/com/aparapi/codegen/test/Access2DIntArray.java new file mode 100644 index 00000000..130dcfc0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Access2DIntArray.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Access2DIntArray { + int[][] ints = new int[1024][]; + + public void run() { + int value = ints[0][0]; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/Access2DIntArrayTest.java b/src/test/java/com/aparapi/codegen/test/Access2DIntArrayTest.java new file mode 100644 index 00000000..4cc93f54 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Access2DIntArrayTest.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class Access2DIntArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global int *ints;\n" + + " int ints__javaArrayLength0;\n" + + " int ints__javaArrayDimension0;\n" + + " int ints__javaArrayLength1;\n" + + " int ints__javaArrayDimension1;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global int *ints, \n" + + " int ints__javaArrayLength0, \n" + + " int ints__javaArrayDimension0, \n" + + " int ints__javaArrayLength1, \n" + + " int ints__javaArrayDimension1, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->ints = ints;\n" + + " this->ints__javaArrayLength0 = ints__javaArrayLength0;\n" + + " this->ints__javaArrayDimension0 = ints__javaArrayDimension0;\n" + + " this->ints__javaArrayLength1 = ints__javaArrayLength1;\n" + + " this->ints__javaArrayDimension1 = ints__javaArrayDimension1;\n" + + " this->passid = passid;\n" + + " {\n" + + " int value = (&this->ints[0 * this->ints__javaArrayDimension0])[0];\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void Access2DIntArrayTest() { + test(com.aparapi.codegen.test.Access2DIntArray.class, expectedException, expectedOpenCL); + } + + @Test + public void Access2DIntArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.Access2DIntArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessBooleanArray.java b/src/test/java/com/aparapi/codegen/test/AccessBooleanArray.java new file mode 100644 index 00000000..c711d52e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessBooleanArray.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessBooleanArray { + boolean[] ba = new boolean[1024]; + + public void run() { + for (int i = 0; i < 1024; i++) { + if (i % 2 == 0) { + ba[i] = true; + } else { + ba[i] = false; + } + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global char *ba; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global char *ba, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ba = ba; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + if ((i % 2)==0){ + this->ba[i] = 1; + } else { + this->ba[i] = 0; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessBooleanArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessBooleanArrayTest.java new file mode 100644 index 00000000..3c385b0b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessBooleanArrayTest.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessBooleanArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global char *ba;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global char *ba, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->ba = ba;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " if ((i % 2)==0){\n" + + " this->ba[i] = 1;\n" + + " } else {\n" + + " this->ba[i] = 0;\n" + + " }\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessBooleanArrayTest() { + test(com.aparapi.codegen.test.AccessBooleanArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessBooleanArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessBooleanArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessByteArray.java b/src/test/java/com/aparapi/codegen/test/AccessByteArray.java new file mode 100644 index 00000000..9596c0b9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessByteArray.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +/** + * + * Test whether we can assign a byte array element. + * @author gfrost + * + */ +public class AccessByteArray { + byte[] bytes = new byte[1024]; + + public void run() { + + for (int i = 0; i < 1024; i++) { + + bytes[i] = (byte) 1; + + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + __global char *bytes; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global char *bytes, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->bytes = bytes; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + this->bytes[i] = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessByteArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessByteArrayTest.java new file mode 100644 index 00000000..be92c00d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessByteArrayTest.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessByteArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global char *bytes;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global char *bytes, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->bytes = bytes;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " this->bytes[i] = 1;\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessByteArrayTest() { + test(com.aparapi.codegen.test.AccessByteArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessByteArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessByteArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessDoubleArray.java b/src/test/java/com/aparapi/codegen/test/AccessDoubleArray.java new file mode 100644 index 00000000..d479cf68 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessDoubleArray.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessDoubleArray { + double[] doubles = new double[1024]; + + public void run() { + + for (int i = 0; i < 1024; i++) { + doubles[i] = 1.0; + } + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + __global double *doubles; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global double *doubles, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->doubles = doubles; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + this->doubles[i] = 1.0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessDoubleArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessDoubleArrayTest.java new file mode 100644 index 00000000..8c43a995 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessDoubleArrayTest.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessDoubleArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n" + + "\n" + + "typedef struct This_s{\n" + + " __global double *doubles;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global double *doubles, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->doubles = doubles;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " this->doubles[i] = 1.0;\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessDoubleArrayTest() { + test(com.aparapi.codegen.test.AccessDoubleArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessDoubleArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessDoubleArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessFloatArray.java b/src/test/java/com/aparapi/codegen/test/AccessFloatArray.java new file mode 100644 index 00000000..8be51ceb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessFloatArray.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessFloatArray { + float[] floats = new float[1024]; + + public void run() { + for (int i = 0; i < 1024; i++) { + floats[i] = 1f; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global float *floats; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global float *floats, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->floats = floats; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + this->floats[i] = 1.0f; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessFloatArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessFloatArrayTest.java new file mode 100644 index 00000000..c6cadebc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessFloatArrayTest.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessFloatArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global float *floats;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global float *floats, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->floats = floats;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " this->floats[i] = 1.0f;\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessFloatArrayTest() { + test(com.aparapi.codegen.test.AccessFloatArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessFloatArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessFloatArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessIntArray.java b/src/test/java/com/aparapi/codegen/test/AccessIntArray.java new file mode 100644 index 00000000..52757e6c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessIntArray.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessIntArray { + int[] ints = new int[1024]; + + public void run() { + for (int i = 0; i < 1024; i++) { + ints[i] = 1; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *ints; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *ints, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ints = ints; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + this->ints[i] = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessIntArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessIntArrayTest.java new file mode 100644 index 00000000..5d405c12 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessIntArrayTest.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessIntArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global int *ints;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global int *ints, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->ints = ints;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " this->ints[i] = 1;\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessIntArrayTest() { + test(com.aparapi.codegen.test.AccessIntArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessIntArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessIntArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessLongArray.java b/src/test/java/com/aparapi/codegen/test/AccessLongArray.java new file mode 100644 index 00000000..ee38585c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessLongArray.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessLongArray { + long[] longs = new long[1024]; + + public void run() { + for (int i = 0; i < 1024; i++) { + longs[i] = 1; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global long *longs; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global long *longs, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->longs = longs; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + this->longs[i] = 1L; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessLongArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessLongArrayTest.java new file mode 100644 index 00000000..c8846eda --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessLongArrayTest.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessLongArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global long *longs;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global long *longs, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->longs = longs;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " this->longs[i] = 1L;\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessLongArrayTest() { + test(com.aparapi.codegen.test.AccessLongArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessLongArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessLongArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessNested2DIntArray.java b/src/test/java/com/aparapi/codegen/test/AccessNested2DIntArray.java new file mode 100644 index 00000000..fe3574c7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessNested2DIntArray.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessNested2DIntArray { + int[] indices = new int[1024]; + + int[][] ints = new int[1024][]; + + public void run() { + int value = ints[indices[0]][0]; + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessNested2DIntArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessNested2DIntArrayTest.java new file mode 100644 index 00000000..e3336f37 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessNested2DIntArrayTest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessNested2DIntArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global int *ints;\n" + + " int ints__javaArrayLength0;\n" + + " int ints__javaArrayDimension0;\n" + + " int ints__javaArrayLength1;\n" + + " int ints__javaArrayDimension1;\n" + + " __global int *indices;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global int *ints, \n" + + " int ints__javaArrayLength0, \n" + + " int ints__javaArrayDimension0, \n" + + " int ints__javaArrayLength1, \n" + + " int ints__javaArrayDimension1, \n" + + " __global int *indices, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->ints = ints;\n" + + " this->ints__javaArrayLength0 = ints__javaArrayLength0;\n" + + " this->ints__javaArrayDimension0 = ints__javaArrayDimension0;\n" + + " this->ints__javaArrayLength1 = ints__javaArrayLength1;\n" + + " this->ints__javaArrayDimension1 = ints__javaArrayDimension1;\n" + + " this->indices = indices;\n" + + " this->passid = passid;\n" + + " {\n" + + " int value = (&this->ints[this->indices[0] * this->ints__javaArrayDimension0])[0];\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessNested2DIntArrayTest() { + test(com.aparapi.codegen.test.AccessNested2DIntArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessNested2DIntArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessNested2DIntArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AccessShortArray.java b/src/test/java/com/aparapi/codegen/test/AccessShortArray.java new file mode 100644 index 00000000..cfddfc88 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessShortArray.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AccessShortArray { + short[] shorts = new short[1024]; + + public void run() { + for (int i = 0; i < 1024; i++) { + shorts[i] = 1; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global short *shorts; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global short *shorts, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->shorts = shorts; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + this->shorts[i] = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AccessShortArrayTest.java b/src/test/java/com/aparapi/codegen/test/AccessShortArrayTest.java new file mode 100644 index 00000000..323ed934 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AccessShortArrayTest.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AccessShortArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {"typedef struct This_s{\n" + + " __global short *shorts;\n" + + " int passid;\n" + + "}This;\n" + + "int get_pass_id(This *this){\n" + + " return this->passid;\n" + + "}\n" + + "__kernel void run(\n" + + " __global short *shorts, \n" + + " int passid\n" + + "){\n" + + " This thisStruct;\n" + + " This* this=&thisStruct;\n" + + " this->shorts = shorts;\n" + + " this->passid = passid;\n" + + " {\n" + + " for (int i = 0; i<1024; i++){\n" + + " this->shorts[i] = 1;\n" + + " }\n" + + " return;\n" + + " }\n" + + "}\n" + + "\n"}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @Test + public void AccessShortArrayTest() { + test(com.aparapi.codegen.test.AccessShortArray.class, expectedException, expectedOpenCL); + } + + @Test + public void AccessShortArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.AccessShortArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AndOrAndPrecedence.java b/src/test/java/com/aparapi/codegen/test/AndOrAndPrecedence.java new file mode 100644 index 00000000..a2c57582 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AndOrAndPrecedence.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AndOrAndPrecedence { + public void run() { + boolean a = true; + boolean b = true; + boolean c = true; + boolean d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a && b || c && d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 && b!=0 || c!=0 && d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AndOrAndPrecedenceTest.java b/src/test/java/com/aparapi/codegen/test/AndOrAndPrecedenceTest.java new file mode 100644 index 00000000..e72927f7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AndOrAndPrecedenceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AndOrAndPrecedenceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void AndOrAndPrecedenceTest() { + test(com.aparapi.codegen.test.AndOrAndPrecedence.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void AndOrAndPrecedenceTestWorksWithCaching() { + test(com.aparapi.codegen.test.AndOrAndPrecedence.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AndOrPrecedence.java b/src/test/java/com/aparapi/codegen/test/AndOrPrecedence.java new file mode 100644 index 00000000..7547bb30 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AndOrPrecedence.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AndOrPrecedence { + public void run() { + boolean a = true; + boolean b = false; + boolean c = false; + @SuppressWarnings("unused") boolean pass = false; + + if (a || b && c) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 0; + char c = 0; + char pass = 0; + if (a!=0 || b!=0 && c!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AndOrPrecedence2.java b/src/test/java/com/aparapi/codegen/test/AndOrPrecedence2.java new file mode 100644 index 00000000..8a306ad4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AndOrPrecedence2.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AndOrPrecedence2 { + public void run() { + boolean a = false; + boolean b = false; + boolean d = false; + @SuppressWarnings("unused") boolean pass = false; + + if (a && !(b && d)) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 0; + char b = 0; + char d = 0; + char pass = 0; + if (a!=0 && (b==0 || d==0)){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AndOrPrecedence2Test.java b/src/test/java/com/aparapi/codegen/test/AndOrPrecedence2Test.java new file mode 100644 index 00000000..b6d165a7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AndOrPrecedence2Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AndOrPrecedence2Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void AndOrPrecedence2Test() { + test(com.aparapi.codegen.test.AndOrPrecedence2.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void AndOrPrecedence2TestWorksWithCaching() { + test(com.aparapi.codegen.test.AndOrPrecedence2.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AndOrPrecedenceTest.java b/src/test/java/com/aparapi/codegen/test/AndOrPrecedenceTest.java new file mode 100644 index 00000000..551dc90c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AndOrPrecedenceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AndOrPrecedenceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void AndOrPrecedenceTest() { + test(com.aparapi.codegen.test.AndOrPrecedence.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void AndOrPrecedenceTestWorksWithCaching() { + test(com.aparapi.codegen.test.AndOrPrecedence.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ArbitraryScope.java b/src/test/java/com/aparapi/codegen/test/ArbitraryScope.java new file mode 100644 index 00000000..f17fa3cd --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArbitraryScope.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ArbitraryScope { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + int tid = 0; + + int i = tid % width; + int j = tid / width; + + float x0 = ((i * scale) - ((scale / 2) * width)) / width; + float y0 = ((j * scale) - ((scale / 2) * width)) / width; + + float x = x0; + float y = y0; + + float x2 = x * x; + float y2 = y * y; + + { + + float scaleSquare = scale * scale; + + int count = 0; + + for (int iter = 0; iter < maxIterations; ++iter) { + if (x2 + y2 <= scaleSquare) { + y = 2 * x * y + y0; + x = x2 - y2 + x0; + + x2 = x * x; + y2 = y * y; + count++; + } else { + count--; + } + } + @SuppressWarnings("unused") int value = (256 * count) / maxIterations; + } + + @SuppressWarnings("unused") float scaleSquare = 1f; + } +} +/**{OpenCL{ + typedef struct This_s{ + int width; + float scale; + int maxIterations; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int width, + float scale, + int maxIterations, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->width = width; + this->scale = scale; + this->maxIterations = maxIterations; + this->passid = passid; + { + int tid = 0; + int i = tid % this->width; + int j = tid / this->width; + float x0 = (((float)i * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float y0 = (((float)j * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float x = x0; + float y = y0; + float x2 = x * x; + float y2 = y * y; + { + float scaleSquare = this->scale * this->scale; + int count = 0; + for (int iter = 0; iter<this->maxIterations; iter++){ + if ((x2 + y2)<=scaleSquare){ + y = ((2.0f * x) * y) + y0; + x = (x2 - y2) + x0; + x2 = x * x; + y2 = y * y; + count++; + } else { + count--; + } + } + int value = (256 * count) / this->maxIterations; + } + float scaleSquare = 1.0f; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ArbitraryScope2.java b/src/test/java/com/aparapi/codegen/test/ArbitraryScope2.java new file mode 100644 index 00000000..fd3ab8c8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArbitraryScope2.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ArbitraryScope2 { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + int tid = 0; + + int i = tid % width; + int j = tid / width; + + float x0 = ((i * scale) - ((scale / 2) * width)) / width; + float y0 = ((j * scale) - ((scale / 2) * width)) / width; + + float x = x0; + float y = y0; + + float x2 = x * x; + float y2 = y * y; + + { + int count = 0; + count++; + } + + float scaleSquare = scale * scale; + + int count = 0; + + for (int iter = 0; iter < maxIterations; ++iter) { + if (x2 + y2 <= scaleSquare) { + y = 2 * x * y + y0; + x = x2 - y2 + x0; + + x2 = x * x; + y2 = y * y; + count++; + } else { + count--; + } + } + @SuppressWarnings("unused") int value = (256 * count) / maxIterations; + + } +} +/**{OpenCL{ + typedef struct This_s{ + int width; + float scale; + int maxIterations; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int width, + float scale, + int maxIterations, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->width = width; + this->scale = scale; + this->maxIterations = maxIterations; + this->passid = passid; + { + int tid = 0; + int i = tid % this->width; + int j = tid / this->width; + float x0 = (((float)i * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float y0 = (((float)j * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float x = x0; + float y = y0; + float x2 = x * x; + float y2 = y * y; + { + int count = 0; + count++; + } + float scaleSquare = this->scale * this->scale; + int count = 0; + for (int iter = 0; iter<this->maxIterations; iter++){ + if ((x2 + y2)<=scaleSquare){ + y = ((2.0f * x) * y) + y0; + x = (x2 - y2) + x0; + x2 = x * x; + y2 = y * y; + count++; + } else { + count--; + } + } + int value = (256 * count) / this->maxIterations; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ArbitraryScope2Test.java b/src/test/java/com/aparapi/codegen/test/ArbitraryScope2Test.java new file mode 100644 index 00000000..a4f42eec --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArbitraryScope2Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ArbitraryScope2Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ArbitraryScope2Test() { + test(com.aparapi.codegen.test.ArbitraryScope2.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ArbitraryScope2TestWorksWithCaching() { + test(com.aparapi.codegen.test.ArbitraryScope2.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimple.java b/src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimple.java new file mode 100644 index 00000000..0c2ac91d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimple.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ArbitraryScopeSimple { + + public void run() { + int value = 10; + { + int count = 10; + float f = 10f; + value = (int) (count * f); + } + @SuppressWarnings("unused") int result = 0; + int count = 0; + result = value + count; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int value = 10; + { + int count = 10; + float f = 10.0f; + value = (int)((float)count * f); + } + int result = 0; + int count = 0; + result = value + count; + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimpleTest.java b/src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimpleTest.java new file mode 100644 index 00000000..230ff974 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArbitraryScopeSimpleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ArbitraryScopeSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ArbitraryScopeSimpleTest() { + test(com.aparapi.codegen.test.ArbitraryScopeSimple.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ArbitraryScopeSimpleTestWorksWithCaching() { + test(com.aparapi.codegen.test.ArbitraryScopeSimple.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ArbitraryScopeTest.java b/src/test/java/com/aparapi/codegen/test/ArbitraryScopeTest.java new file mode 100644 index 00000000..b18e9725 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArbitraryScopeTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ArbitraryScopeTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ArbitraryScopeTest() { + test(com.aparapi.codegen.test.ArbitraryScope.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ArbitraryScopeTestWorksWithCaching() { + test(com.aparapi.codegen.test.ArbitraryScope.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35.java b/src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35.java new file mode 100644 index 00000000..0755b538 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ArrayTortureIssue35 { + int[] a = new int[1]; + + int[] b = new int[1]; + + public void run() { + a[b[0]++] = 1; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *a; + __global int *b; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *a, + __global int *b, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->a = a; + this->b = b; + this->passid = passid; + { + this->a[this->b[0]++] = 1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35Test.java b/src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35Test.java new file mode 100644 index 00000000..c2c5168c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ArrayTortureIssue35Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ArrayTortureIssue35Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ArrayTortureIssue35Test() { + test(com.aparapi.codegen.test.ArrayTortureIssue35.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ArrayTortureIssue35TestWorksWithCaching() { + test(com.aparapi.codegen.test.ArrayTortureIssue35.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Assign2DIntArray.java b/src/test/java/com/aparapi/codegen/test/Assign2DIntArray.java new file mode 100644 index 00000000..e38d8b5b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Assign2DIntArray.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Assign2DIntArray { + int[][] ints = new int[1024][]; + + public void run() { + ints[0][0] = 1; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/Assign2DIntArrayTest.java b/src/test/java/com/aparapi/codegen/test/Assign2DIntArrayTest.java new file mode 100644 index 00000000..cbdc2c8b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Assign2DIntArrayTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class Assign2DIntArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void Assign2DIntArrayTest() { + test(com.aparapi.codegen.test.Assign2DIntArray.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void Assign2DIntArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.Assign2DIntArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameter.java b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameter.java new file mode 100644 index 00000000..f52a5a7f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameter.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AssignAndPassAsParameter { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + int y = 2; + + int actuallyDoIt(int a) { + return 1; + } + + public void run() { + actuallyDoIt(results[y] = actuallyDoIt(y)); + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *results; + int y; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_AssignAndPassAsParameter__actuallyDoIt(This *this, int a){ + return(1); + } + __kernel void run( + __global int *results, + int y, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->results = results; + this->y = y; + this->passid = passid; + { + com_amd_aparapi_test_AssignAndPassAsParameter__actuallyDoIt(this, this->results[this->y] = com_amd_aparapi_test_AssignAndPassAsParameter__actuallyDoIt(this, this->y)); + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimple.java b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimple.java new file mode 100644 index 00000000..eb0c1044 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimple.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AssignAndPassAsParameterSimple { + + void actuallyDoIt(int a) { + + } + + public void run() { + @SuppressWarnings("unused") int z; + actuallyDoIt(z = 1); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimpleTest.java b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimpleTest.java new file mode 100644 index 00000000..c30743c1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterSimpleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AssignAndPassAsParameterSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void AssignAndPassAsParameterSimpleTest() { + test(com.aparapi.codegen.test.AssignAndPassAsParameterSimple.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void AssignAndPassAsParameterSimpleTestWorksWithCaching() { + test(com.aparapi.codegen.test.AssignAndPassAsParameterSimple.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterTest.java b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterTest.java new file mode 100644 index 00000000..8c15f787 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AssignAndPassAsParameterTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AssignAndPassAsParameterTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void AssignAndPassAsParameterTest() { + test(com.aparapi.codegen.test.AssignAndPassAsParameter.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void AssignAndPassAsParameterTestWorksWithCaching() { + test(com.aparapi.codegen.test.AssignAndPassAsParameter.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/AssignField.java b/src/test/java/com/aparapi/codegen/test/AssignField.java new file mode 100644 index 00000000..32ea9432 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AssignField.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class AssignField { + int field = 1024; + + public void run() { + field = 100; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/AssignFieldTest.java b/src/test/java/com/aparapi/codegen/test/AssignFieldTest.java new file mode 100644 index 00000000..9376dbfb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/AssignFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class AssignFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void AssignFieldTest() { + test(com.aparapi.codegen.test.AssignField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void AssignFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.AssignField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Atomic32Pragma.java b/src/test/java/com/aparapi/codegen/test/Atomic32Pragma.java new file mode 100644 index 00000000..6067b2d9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Atomic32Pragma.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class Atomic32Pragma extends Kernel { + + final int[] values = new int[10]; + + @Override + public void run() { + atomicAdd(values, 1, 1); + } +} + +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable + #pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable + #pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable + #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable + int atomicAdd(__global int *_arr, int _index, int _delta){ + return atomic_add(&_arr[_index], _delta); + } + typedef struct This_s{ + __global int *values; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *values, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->passid = passid; + { + atomicAdd(this->values, 1, 1); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/Atomic32PragmaTest.java b/src/test/java/com/aparapi/codegen/test/Atomic32PragmaTest.java new file mode 100644 index 00000000..a5337c95 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Atomic32PragmaTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class Atomic32PragmaTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void Atomic32PragmaTest() { + test(com.aparapi.codegen.test.Atomic32Pragma.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void Atomic32PragmaTestWorksWithCaching() { + test(com.aparapi.codegen.test.Atomic32Pragma.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/BooleanToggle.java b/src/test/java/com/aparapi/codegen/test/BooleanToggle.java new file mode 100644 index 00000000..19d9ecfc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/BooleanToggle.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class BooleanToggle { + public void run() { + boolean pass = false; + + pass = !pass; + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + pass = (pass==0)?1:0; + return; + } + } + }OpenCL}**/ +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + pass = (pass!=0)?0:1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/BooleanToggleTest.java b/src/test/java/com/aparapi/codegen/test/BooleanToggleTest.java new file mode 100644 index 00000000..22640e29 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/BooleanToggleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class BooleanToggleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void BooleanToggleTest() { + test(com.aparapi.codegen.test.BooleanToggle.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void BooleanToggleTestWorksWithCaching() { + test(com.aparapi.codegen.test.BooleanToggle.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Break.java b/src/test/java/com/aparapi/codegen/test/Break.java new file mode 100644 index 00000000..426e5f79 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Break.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Break { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i < 10; i++) { + if (i == 5) { + break; + } + pass = true; + } + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/BreakTest.java b/src/test/java/com/aparapi/codegen/test/BreakTest.java new file mode 100644 index 00000000..73daa3d5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/BreakTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class BreakTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void BreakTest() { + test(com.aparapi.codegen.test.Break.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void BreakTestWorksWithCaching() { + test(com.aparapi.codegen.test.Break.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ByteParams.java b/src/test/java/com/aparapi/codegen/test/ByteParams.java new file mode 100644 index 00000000..910cc8df --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ByteParams.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ByteParams { + + // input for addEmUp2 + byte[] test = new byte[4]; + + byte addEmUp2(byte x, byte y) { + return (byte) ((byte) x + (byte) y); + } + + public void run() { + + @SuppressWarnings("unused") byte bb = 0; + byte cc = 7; + + addEmUp2((bb = cc), cc); + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + char com_amd_aparapi_test_ByteParams__addEmUp2(This *this, char x, char y){ + return((char )(x + y)); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char bb = 0; + char cc = 7; + com_amd_aparapi_test_ByteParams__addEmUp2(this, bb = cc, cc); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ByteParamsSimple.java b/src/test/java/com/aparapi/codegen/test/ByteParamsSimple.java new file mode 100644 index 00000000..6040d125 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ByteParamsSimple.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ByteParamsSimple { + + void addEmUp2(byte x, byte y) { + + } + + public void run() { + + byte bb = 0; + byte cc = 7; + + addEmUp2(bb, cc); + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_ByteParamsSimple__addEmUp2(This *this, char x, char y){ + return; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char bb = 0; + char cc = 7; + com_amd_aparapi_test_ByteParamsSimple__addEmUp2(this, bb, cc); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ByteParamsSimpleTest.java b/src/test/java/com/aparapi/codegen/test/ByteParamsSimpleTest.java new file mode 100644 index 00000000..c3998f22 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ByteParamsSimpleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ByteParamsSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ByteParamsSimpleTest() { + test(com.aparapi.codegen.test.ByteParamsSimple.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ByteParamsSimpleTestWorksWithCaching() { + test(com.aparapi.codegen.test.ByteParamsSimple.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ByteParamsTest.java b/src/test/java/com/aparapi/codegen/test/ByteParamsTest.java new file mode 100644 index 00000000..4f8f6063 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ByteParamsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ByteParamsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ByteParamsTest() { + test(com.aparapi.codegen.test.ByteParams.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ByteParamsTestWorksWithCaching() { + test(com.aparapi.codegen.test.ByteParams.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallGetPassId.java b/src/test/java/com/aparapi/codegen/test/CallGetPassId.java new file mode 100644 index 00000000..4eababb9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallGetPassId.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class CallGetPassId extends Kernel { + public void run() { + int thePassId = getPassId(); + } + +} +/**{OpenCL{ + + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int thePassId = get_pass_id(this); + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallGetPassIdTest.java b/src/test/java/com/aparapi/codegen/test/CallGetPassIdTest.java new file mode 100644 index 00000000..408a2b2c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallGetPassIdTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallGetPassIdTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallGetPassIdTest() { + test(com.aparapi.codegen.test.CallGetPassId.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallGetPassIdTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallGetPassId.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallObject.java b/src/test/java/com/aparapi/codegen/test/CallObject.java new file mode 100644 index 00000000..13a5553f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallObject.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class CallObject extends Kernel { + Dummy dummy = new Dummy(); + + ; + int out[] = new int[2]; + + public void run() { + out[0] = dummy.foo(); + } + + static class Dummy { + public int foo() { + return 42; + } + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallObjectStatic.java b/src/test/java/com/aparapi/codegen/test/CallObjectStatic.java new file mode 100644 index 00000000..2f135007 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallObjectStatic.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class CallObjectStatic extends Kernel { + int out[] = new int[2]; + + ; + + public void run() { + out[0] = Dummy.foo(); + } + + static class Dummy { + static public int foo() { + return 42; + } + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_CallObjectStatic$Dummy__foo(){ + return(42); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_CallObjectStatic$Dummy__foo(); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallObjectStaticTest.java b/src/test/java/com/aparapi/codegen/test/CallObjectStaticTest.java new file mode 100644 index 00000000..2adfbbde --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallObjectStaticTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallObjectStaticTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallObjectStaticTest() { + test(com.aparapi.codegen.test.CallObjectStatic.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallObjectStaticTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallObjectStatic.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallObjectTest.java b/src/test/java/com/aparapi/codegen/test/CallObjectTest.java new file mode 100644 index 00000000..c26d62f3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallObjectTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallObjectTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallObjectTest() { + test(com.aparapi.codegen.test.CallObject.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallObjectTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallObject.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallRunSuper.java b/src/test/java/com/aparapi/codegen/test/CallRunSuper.java new file mode 100644 index 00000000..9ed326d0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallRunSuper.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +class CallRunSuperBase extends Kernel { + int out[] = new int[2]; + + @Override + public void run() { + out[0] = 2; + } +} + +public class CallRunSuper extends CallRunSuperBase { + public void run() { + super.run(); + out[1] = 3; + } + +} +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_CallRunSuperBase__run(This *this){ + this->out[0] = 2; + return; + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + com_amd_aparapi_test_CallRunSuperBase__run(this); + this->out[1] = 3; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallRunSuperTest.java b/src/test/java/com/aparapi/codegen/test/CallRunSuperTest.java new file mode 100644 index 00000000..e70e71a9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallRunSuperTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallRunSuperTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallRunSuperTest() { + test(com.aparapi.codegen.test.CallRunSuper.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallRunSuperTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallRunSuper.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClass.java b/src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClass.java new file mode 100644 index 00000000..d6666f05 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClass.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +class AnotherClass { + static public int foo() { + return 42; + } +}; + +public class CallStaticInAnotherClass extends Kernel { + + int out[] = new int[2]; + + public int doodoo() { + return AnotherClass.foo(); + } + + public void run() { + out[0] = AnotherClass.foo() + doodoo(); + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_AnotherClass__foo(){ + return(42); + } + int com_amd_aparapi_test_CallStaticInAnotherClass__doodoo(This *this){ + return(com_amd_aparapi_test_AnotherClass__foo()); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_AnotherClass__foo() + com_amd_aparapi_test_CallStaticInAnotherClass__doodoo(this); + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClassTest.java b/src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClassTest.java new file mode 100644 index 00000000..df8c0943 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallStaticInAnotherClassTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallStaticInAnotherClassTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallStaticInAnotherClassTest() { + test(com.aparapi.codegen.test.CallStaticInAnotherClass.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallStaticInAnotherClassTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallStaticInAnotherClass.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallSuper.java b/src/test/java/com/aparapi/codegen/test/CallSuper.java new file mode 100644 index 00000000..5e3913bf --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallSuper.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +abstract class CallSuperBase extends Kernel { + int foo(int n) { + return n * 2; + } +} + +public class CallSuper extends CallSuperBase { + int out[] = new int[1]; + + public void run() { + out[0] = foo(2); + } + + int foo(int n) { + return 1 + super.foo(n); + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_CallSuperBase__foo(This *this, int n){ + return((n * 2)); + } + int com_amd_aparapi_test_CallSuper__foo(This *this, int n){ + return((1 + com_amd_aparapi_test_CallSuperBase__foo(this, n))); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_CallSuper__foo(this, 2); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallSuperTest.java b/src/test/java/com/aparapi/codegen/test/CallSuperTest.java new file mode 100644 index 00000000..2270d9b3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallSuperTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallSuperTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallSuperTest() { + test(com.aparapi.codegen.test.CallSuper.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallSuperTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallSuper.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CallTwice.java b/src/test/java/com/aparapi/codegen/test/CallTwice.java new file mode 100644 index 00000000..fe331587 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallTwice.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class CallTwice extends Kernel { + + int out[] = new int[1]; + + public int getOne() { + return (1); + } + + @Override + public void run() { + out[0] = getOne() + getOne(); + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_CallTwice__getOne(This *this){ + return(1); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_CallTwice__getOne(this) + com_amd_aparapi_test_CallTwice__getOne(this); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CallTwiceTest.java b/src/test/java/com/aparapi/codegen/test/CallTwiceTest.java new file mode 100644 index 00000000..8effb469 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CallTwiceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CallTwiceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CallTwiceTest() { + test(com.aparapi.codegen.test.CallTwice.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CallTwiceTestWorksWithCaching() { + test(com.aparapi.codegen.test.CallTwice.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CharArrayField.java b/src/test/java/com/aparapi/codegen/test/CharArrayField.java new file mode 100644 index 00000000..0f398785 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CharArrayField.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class CharArrayField { + char out[] = new char[1]; + + public void run() { + out[0] = 0; + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global unsigned short *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global unsigned short *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = 0; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CharArrayFieldTest.java b/src/test/java/com/aparapi/codegen/test/CharArrayFieldTest.java new file mode 100644 index 00000000..5790c1d1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CharArrayFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CharArrayFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CharArrayFieldTest() { + test(com.aparapi.codegen.test.CharArrayField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CharArrayFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.CharArrayField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CharAsParameter.java b/src/test/java/com/aparapi/codegen/test/CharAsParameter.java new file mode 100644 index 00000000..7433aad1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CharAsParameter.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class CharAsParameter { + + public char doIt(char x) { + return x; + } + + public void run() { + byte b = 0x1; + + doIt('A'); + + doIt((char) b); + } +} + +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + unsigned short com_amd_aparapi_test_CharAsParameter__doIt(This *this, unsigned short x){ + return(x); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char b = 1; + com_amd_aparapi_test_CharAsParameter__doIt(this, 65); + com_amd_aparapi_test_CharAsParameter__doIt(this, (unsigned short )b); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CharAsParameterTest.java b/src/test/java/com/aparapi/codegen/test/CharAsParameterTest.java new file mode 100644 index 00000000..915f112a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CharAsParameterTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CharAsParameterTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CharAsParameterTest() { + test(com.aparapi.codegen.test.CharAsParameter.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CharAsParameterTestWorksWithCaching() { + test(com.aparapi.codegen.test.CharAsParameter.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CharType.java b/src/test/java/com/aparapi/codegen/test/CharType.java new file mode 100644 index 00000000..fd997320 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CharType.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class CharType extends Kernel { + int out[] = new int[1]; + + @Override + public void run() { + final char c = Character.MAX_VALUE; + this.out[0] = c; + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + unsigned short c = 65535; + this->out[0] = 65535; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CharTypeTest.java b/src/test/java/com/aparapi/codegen/test/CharTypeTest.java new file mode 100644 index 00000000..eb5e98d8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CharTypeTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CharTypeTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CharTypeTest() { + test(com.aparapi.codegen.test.CharType.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CharTypeTestWorksWithCaching() { + test(com.aparapi.codegen.test.CharType.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccess.java b/src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccess.java new file mode 100644 index 00000000..3b3d296e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccess.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ClassHasStaticFieldAccess { + static int foo = 6; + int[] ints = new int[1024]; + + public void run() { + for (int i = 0; i < 1024; i++) { + if (i % 2 == 0) { + ints[i] = foo; + } + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *ints; + int foo; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global int *ints, + int foo, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ints = ints; + this->foo = foo; + this->passid = passid; + { + for (int i = 0; i<1024; i++){ + if ((i % 2)==0){ + this->ints[i] = foo; + } + } + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccessTest.java b/src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccessTest.java new file mode 100644 index 00000000..6bd9a0ab --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ClassHasStaticFieldAccessTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ClassHasStaticFieldAccessTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ClassHasStaticFieldAccessTest() { + test(com.aparapi.codegen.test.ClassHasStaticFieldAccess.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ClassHasStaticFieldAccessTestWorksWithCaching() { + test(com.aparapi.codegen.test.ClassHasStaticFieldAccess.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethod.java b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethod.java new file mode 100644 index 00000000..8277d55f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethod.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ClassHasStaticMethod { + int[] ints = new int[1024]; + + static int getIntAndReturnIt(int a) { + return (int) (((int) 1) - a); + } + + public void run() { + int foo = 1; + for (int i = 0; i < 1024; i++) { + if (i % 2 == 0) { + ints[i] = foo; + } else { + ints[i] = getIntAndReturnIt(foo); + ; + } + } + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *ints; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_ClassHasStaticMethod__getIntAndReturnIt(int a){ + return((1 - a)); + } + __kernel void run( + __global int *ints, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ints = ints; + this->passid = passid; + { + int foo = 1; + for (int i = 0; i<1024; i++){ + if ((i % 2)==0){ + this->ints[i] = foo; + } else { + this->ints[i] = com_amd_aparapi_test_ClassHasStaticMethod__getIntAndReturnIt(foo); + } + } + return; + } + } + }OpenCL}**/ + diff --git a/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimple.java b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimple.java new file mode 100644 index 00000000..0e7ce96c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimple.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ClassHasStaticMethodSimple { + + static void staticMethod() { + + } + + public void run() { + staticMethod(); + + } +} + +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + void com_amd_aparapi_test_ClassHasStaticMethodSimple__staticMethod(){ + return; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + com_amd_aparapi_test_ClassHasStaticMethodSimple__staticMethod(); + return; + } + } + }OpenCL}**/ + diff --git a/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimpleTest.java b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimpleTest.java new file mode 100644 index 00000000..99f6dff2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodSimpleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ClassHasStaticMethodSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ClassHasStaticMethodSimpleTest() { + test(com.aparapi.codegen.test.ClassHasStaticMethodSimple.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ClassHasStaticMethodSimpleTestWorksWithCaching() { + test(com.aparapi.codegen.test.ClassHasStaticMethodSimple.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodTest.java b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodTest.java new file mode 100644 index 00000000..ed001eaa --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ClassHasStaticMethodTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ClassHasStaticMethodTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ClassHasStaticMethodTest() { + test(com.aparapi.codegen.test.ClassHasStaticMethod.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ClassHasStaticMethodTestWorksWithCaching() { + test(com.aparapi.codegen.test.ClassHasStaticMethod.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/CompositeArbitraryScope.java b/src/test/java/com/aparapi/codegen/test/CompositeArbitraryScope.java new file mode 100644 index 00000000..54066055 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CompositeArbitraryScope.java @@ -0,0 +1,199 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +// this example gave the following error: +/// com.codegen.classtools.writer.CodeGenException: composite COMPOSITE_ARBITRARY_SCOPE + +import com.aparapi.Kernel; + +public class CompositeArbitraryScope extends Kernel { + + void t5() { + int gid = getGlobalId(); + int numRemaining = 1; + int thisCount = 0; + while (numRemaining > 0 && gid > 0) { + numRemaining += 1; + thisCount = min(numRemaining, gid); + numRemaining -= thisCount; + numRemaining += 1; + } + gid -= thisCount; + } + + void t4() { + int gid = getGlobalId(); + int numRemaining = 1; + while (numRemaining > 0 && gid > 0) { + numRemaining += 1; + int thisCount = min(numRemaining, gid); + numRemaining -= thisCount; + numRemaining += 1; + gid--; + } + } + + void t3() { + int gid = getGlobalId(); + int numRemaining = 1; + while (numRemaining > 0) { + numRemaining += 1; + int thisCount = min(numRemaining, gid); + numRemaining -= thisCount; + numRemaining += 1; + } + } + + void t2() { + int gid = getGlobalId(); + int numRemaining = 1; + while (numRemaining > 0) { + { + int thisCount = min(numRemaining, gid); + numRemaining -= thisCount; + } + numRemaining += 0; + } + } + + void t1() { + int gid = getGlobalId(); + int numRemaining = 1; + while (numRemaining > 0) { + numRemaining += 1; + int thisCount = min(numRemaining, gid); + numRemaining -= thisCount; + } + } + + @Override + public void run() { + int gid = getGlobalId(); + int numRemaining = 1; + + t1(); + t2(); + t3(); + t4(); + t5(); + + while (numRemaining > 0) { + numRemaining += 1; + { + int thisCount = min(numRemaining, gid); + numRemaining -= thisCount; + } + } + } +} + +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_CompositeArbitraryScope__t5(This *this){ + int gid = get_global_id(0); + int numRemaining = 1; + int thisCount = 0; + for (; numRemaining>0 && gid>0; numRemaining++){ + numRemaining++; + thisCount = min(numRemaining, gid); + numRemaining = numRemaining - thisCount; + } + gid = gid - thisCount; + return; + } + void com_amd_aparapi_test_CompositeArbitraryScope__t4(This *this){ + int gid = get_global_id(0); + int numRemaining = 1; + while (numRemaining>0 && gid>0){ + numRemaining++; + { + int thisCount = min(numRemaining, gid); + numRemaining = numRemaining - thisCount; + numRemaining++; + gid--; + } + } + return; + } + void com_amd_aparapi_test_CompositeArbitraryScope__t3(This *this){ + int gid = get_global_id(0); + int numRemaining = 1; + while (numRemaining>0){ + numRemaining++; + { + int thisCount = min(numRemaining, gid); + numRemaining = numRemaining - thisCount; + numRemaining++; + } + } + return; + } + void com_amd_aparapi_test_CompositeArbitraryScope__t2(This *this){ + int gid = get_global_id(0); + int numRemaining = 1; + for (; numRemaining>0; numRemaining){ + { + int thisCount = min(numRemaining, gid); + numRemaining = numRemaining - thisCount; + } + } + return; + } + void com_amd_aparapi_test_CompositeArbitraryScope__t1(This *this){ + int gid = get_global_id(0); + int numRemaining = 1; + while (numRemaining>0){ + numRemaining++; + { + int thisCount = min(numRemaining, gid); + numRemaining = numRemaining - thisCount; + } + } + return; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int gid = get_global_id(0); + int numRemaining = 1; + com_amd_aparapi_test_CompositeArbitraryScope__t1(this); + com_amd_aparapi_test_CompositeArbitraryScope__t2(this); + com_amd_aparapi_test_CompositeArbitraryScope__t3(this); + com_amd_aparapi_test_CompositeArbitraryScope__t4(this); + com_amd_aparapi_test_CompositeArbitraryScope__t5(this); + while (numRemaining>0){ + numRemaining++; + { + int thisCount = min(numRemaining, gid); + numRemaining = numRemaining - thisCount; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/CompositeArbitraryScopeTest.java b/src/test/java/com/aparapi/codegen/test/CompositeArbitraryScopeTest.java new file mode 100644 index 00000000..7e581aae --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/CompositeArbitraryScopeTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class CompositeArbitraryScopeTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void CompositeArbitraryScopeTest() { + test(com.aparapi.codegen.test.CompositeArbitraryScope.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void CompositeArbitraryScopeTestWorksWithCaching() { + test(com.aparapi.codegen.test.CompositeArbitraryScope.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ConstantAssignInExpression.java b/src/test/java/com/aparapi/codegen/test/ConstantAssignInExpression.java new file mode 100644 index 00000000..03cacda6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ConstantAssignInExpression.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ConstantAssignInExpression { + + void func(int _arg) { + // nada + } + + public void run() { + @SuppressWarnings("unused") int result = 1; + func(result = 0); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_ConstantAssignInExpression__func(This *this, int _arg){ + return; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int result = 1; + com_amd_aparapi_test_ConstantAssignInExpression__func(this, result=0); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ConstantAssignInExpressionTest.java b/src/test/java/com/aparapi/codegen/test/ConstantAssignInExpressionTest.java new file mode 100644 index 00000000..b6ef1cf2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ConstantAssignInExpressionTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ConstantAssignInExpressionTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ConstantAssignInExpressionTest() { + test(com.aparapi.codegen.test.ConstantAssignInExpression.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ConstantAssignInExpressionTestWorksWithCaching() { + test(com.aparapi.codegen.test.ConstantAssignInExpression.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Continue.java b/src/test/java/com/aparapi/codegen/test/Continue.java new file mode 100644 index 00000000..67856f48 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Continue.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Continue { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i < 10; i++) { + if (i == 5) { + continue; + } + pass = true; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i<10; i++){ + if (i==5){ + } else { + pass = 1; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ContinueTest.java b/src/test/java/com/aparapi/codegen/test/ContinueTest.java new file mode 100644 index 00000000..3e349248 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ContinueTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ContinueTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ContinueTest() { + test(com.aparapi.codegen.test.Continue.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ContinueTestWorksWithCaching() { + test(com.aparapi.codegen.test.Continue.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ContinueTorture.java b/src/test/java/com/aparapi/codegen/test/ContinueTorture.java new file mode 100644 index 00000000..5ab3f07e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ContinueTorture.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ContinueTorture { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + int myId = 34; + + int actuallyDoIt(int a) { + return 1; + } + + int actuallyDoIt2(int a) { + return -1; + } + + public void run() { + int idx = myId; + while (--idx > 0) { + + if (myId == 0) { + continue; + } + if (myId % 2 == 0) { + results[myId] = actuallyDoIt(idx); + continue; + } else { + results[myId] = actuallyDoIt2(idx); + continue; + } + } + } +} +//**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ContinueTortureTest.java b/src/test/java/com/aparapi/codegen/test/ContinueTortureTest.java new file mode 100644 index 00000000..eef016f7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ContinueTortureTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ContinueTortureTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ContinueTortureTest() { + test(com.aparapi.codegen.test.ContinueTorture.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ContinueTortureTestWorksWithCaching() { + test(com.aparapi.codegen.test.ContinueTorture.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/DirectRecursion.java b/src/test/java/com/aparapi/codegen/test/DirectRecursion.java new file mode 100644 index 00000000..76153fab --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/DirectRecursion.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class DirectRecursion extends Kernel { + + int intout[] = new int[1]; + + public void run() { + intout[0] = fact(10); + @SuppressWarnings("unused") boolean pass = false; + } + + int fact(int n) { + return (n <= 1 ? n : n * fact(n - 1)); + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/DirectRecursionTest.java b/src/test/java/com/aparapi/codegen/test/DirectRecursionTest.java new file mode 100644 index 00000000..e105289d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/DirectRecursionTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class DirectRecursionTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void DirectRecursionTest() { + test(com.aparapi.codegen.test.DirectRecursion.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void DirectRecursionTestWorksWithCaching() { + test(com.aparapi.codegen.test.DirectRecursion.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/DoWhile.java b/src/test/java/com/aparapi/codegen/test/DoWhile.java new file mode 100644 index 00000000..22d21172 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/DoWhile.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class DoWhile { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + do { + pass = true; + i++; + } while (i < 10); + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + do{ + pass = 1; + i++; + }while (i<10); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/DoWhileTest.java b/src/test/java/com/aparapi/codegen/test/DoWhileTest.java new file mode 100644 index 00000000..863699b6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/DoWhileTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class DoWhileTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void DoWhileTest() { + test(com.aparapi.codegen.test.DoWhile.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void DoWhileTestWorksWithCaching() { + test(com.aparapi.codegen.test.DoWhile.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Drem.java b/src/test/java/com/aparapi/codegen/test/Drem.java new file mode 100644 index 00000000..f1fa250c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Drem.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Drem { + double out[] = new double[10]; + double m; + double n; + + public void run() { + out[0] = m % n; + } +} + +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + __global double *out; + double m; + double n; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global double *out, + double m, + double n, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->m = m; + this->n = n; + this->passid = passid; + { + this->out[0] = this->m % this->n; + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/DremTest.java b/src/test/java/com/aparapi/codegen/test/DremTest.java new file mode 100644 index 00000000..e30bc872 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/DremTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class DremTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void DremTest() { + test(com.aparapi.codegen.test.Drem.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void DremTestWorksWithCaching() { + test(com.aparapi.codegen.test.Drem.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/EarlyReturn.java b/src/test/java/com/aparapi/codegen/test/EarlyReturn.java new file mode 100644 index 00000000..67283b36 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/EarlyReturn.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class EarlyReturn { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if ((i % 2) == 0) { + return; + } + i++; + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i=0; + if ((i%2)==0){ + return; + } + i++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/EarlyReturnTest.java b/src/test/java/com/aparapi/codegen/test/EarlyReturnTest.java new file mode 100644 index 00000000..5024cdc8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/EarlyReturnTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class EarlyReturnTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void EarlyReturnTest() { + test(com.aparapi.codegen.test.EarlyReturn.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void EarlyReturnTestWorksWithCaching() { + test(com.aparapi.codegen.test.EarlyReturn.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/EmptyWhileWithInc.java b/src/test/java/com/aparapi/codegen/test/EmptyWhileWithInc.java new file mode 100644 index 00000000..b20024b3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/EmptyWhileWithInc.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class EmptyWhileWithInc { + public void run() { + int x = 0; + while (x++ < 10) { + } + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + for (int x = 0; x++<10;){} + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/EmptyWhileWithIncTest.java b/src/test/java/com/aparapi/codegen/test/EmptyWhileWithIncTest.java new file mode 100644 index 00000000..388c88a4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/EmptyWhileWithIncTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class EmptyWhileWithIncTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void EmptyWhileWithIncTest() { + test(com.aparapi.codegen.test.EmptyWhileWithInc.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void EmptyWhileWithIncTestWorksWithCaching() { + test(com.aparapi.codegen.test.EmptyWhileWithInc.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/EntrypointRecursion.java b/src/test/java/com/aparapi/codegen/test/EntrypointRecursion.java new file mode 100644 index 00000000..52c6e548 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/EntrypointRecursion.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class EntrypointRecursion extends Kernel { + + int[] values = new int[128]; + + public void run() { + int id = getGlobalId(); + + values[id]++; + + if (values[id] < 20) { + run(); + } + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/EntrypointRecursionTest.java b/src/test/java/com/aparapi/codegen/test/EntrypointRecursionTest.java new file mode 100644 index 00000000..67ef9931 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/EntrypointRecursionTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class EntrypointRecursionTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void EntrypointRecursionTest() { + test(com.aparapi.codegen.test.EntrypointRecursion.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void EntrypointRecursionTestWorksWithCaching() { + test(com.aparapi.codegen.test.EntrypointRecursion.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Ex.java b/src/test/java/com/aparapi/codegen/test/Ex.java new file mode 100644 index 00000000..4baf8012 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Ex.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Ex { + public void run() { + int total = 0; + for (int i = 0; i < 100; i++) { + if (i % 10 == 0 && i % 4 == 0) { + total++; + } + } + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int total = 0; + for (int i = 0; i<100; i++){ + if ((i % 10)==0 && (i % 4)==0){ + total++; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ExTest.java b/src/test/java/com/aparapi/codegen/test/ExTest.java new file mode 100644 index 00000000..809dd3e1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ExTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ExTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ExTest() { + test(com.aparapi.codegen.test.Ex.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ExTestWorksWithCaching() { + test(com.aparapi.codegen.test.Ex.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression.java b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression.java new file mode 100644 index 00000000..82225037 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class FirstAssignInExpression { + + int y = 2; + + void func(int _arg) { + // nada + } + + public void run() { + int value = 1; + @SuppressWarnings("unused") int result; + func(result = value); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void func(This *this, int _arg){ + return; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int result; + func(this, result = 0); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2.java b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2.java new file mode 100644 index 00000000..05272630 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class FirstAssignInExpression2 { + + public void run() { + int value = 1; + int assignMe; + int result = 0; + if (value == value) { + result = assignMe = value; + } else { + assignMe = 1; + result = 2; + } + result++; + assignMe++; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int value = 1; + int result=0; + int assignMe=0; + if (true){ + result = assignMe = value; + }else{ + assignMe =1; + result=2; + } + result++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2Test.java b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2Test.java new file mode 100644 index 00000000..49dfd770 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpression2Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class FirstAssignInExpression2Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void FirstAssignInExpression2Test() { + test(com.aparapi.codegen.test.FirstAssignInExpression2.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void FirstAssignInExpression2TestWorksWithCaching() { + test(com.aparapi.codegen.test.FirstAssignInExpression2.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/FirstAssignInExpressionTest.java b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpressionTest.java new file mode 100644 index 00000000..2bf88c25 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FirstAssignInExpressionTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class FirstAssignInExpressionTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void FirstAssignInExpressionTest() { + test(com.aparapi.codegen.test.FirstAssignInExpression.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void FirstAssignInExpressionTestWorksWithCaching() { + test(com.aparapi.codegen.test.FirstAssignInExpression.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/FloatParams.java b/src/test/java/com/aparapi/codegen/test/FloatParams.java new file mode 100644 index 00000000..bad31815 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FloatParams.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class FloatParams { + + int addEmUp(float y, float z) { + return ((int) y + (int) z); + } + + public void run() { + + int y = 2; + + float x = 0f; + + addEmUp((x = (float) y), x); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_FloatParams__addEmUp(This *this, float y, float z){ + return(((int)y + (int)z)); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int y = 2; + float x = 0.0f; + com_amd_aparapi_test_FloatParams__addEmUp(this, x=(float)y, x); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/FloatParamsSimple.java b/src/test/java/com/aparapi/codegen/test/FloatParamsSimple.java new file mode 100644 index 00000000..5b3ecf23 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FloatParamsSimple.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class FloatParamsSimple { + + void floatParams(float y) { + + } + + public void run() { + + floatParams(0f); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_FloatParamsSimple__floatParams(This *this, float y){ + return; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + com_amd_aparapi_test_FloatParamsSimple__floatParams(this, 0.0f); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/FloatParamsSimpleTest.java b/src/test/java/com/aparapi/codegen/test/FloatParamsSimpleTest.java new file mode 100644 index 00000000..40595596 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FloatParamsSimpleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class FloatParamsSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void FloatParamsSimpleTest() { + test(com.aparapi.codegen.test.FloatParamsSimple.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void FloatParamsSimpleTestWorksWithCaching() { + test(com.aparapi.codegen.test.FloatParamsSimple.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/FloatParamsTest.java b/src/test/java/com/aparapi/codegen/test/FloatParamsTest.java new file mode 100644 index 00000000..378829a1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FloatParamsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class FloatParamsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void FloatParamsTest() { + test(com.aparapi.codegen.test.FloatParams.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void FloatParamsTestWorksWithCaching() { + test(com.aparapi.codegen.test.FloatParams.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/For.java b/src/test/java/com/aparapi/codegen/test/For.java new file mode 100644 index 00000000..1976b209 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/For.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class For { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i < 10; i++) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i<10; i++){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForAnd.java b/src/test/java/com/aparapi/codegen/test/ForAnd.java new file mode 100644 index 00000000..f5abc211 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAnd.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForAnd { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i > 2 && i < 10; i++) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i>2 && i<10; i++){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForAndMandel.java b/src/test/java/com/aparapi/codegen/test/ForAndMandel.java new file mode 100644 index 00000000..9646ed1c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAndMandel.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForAndMandel { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + int tid = 0; + + int i = tid % width; + int j = tid / width; + + float x0 = ((i * scale) - ((scale / 2) * width)) / width; + float y0 = ((j * scale) - ((scale / 2) * width)) / width; + + float x = x0; + float y = y0; + + float x2 = x * x; + float y2 = y * y; + + float scaleSquare = scale * scale; + + int count = 0; + + for (int iter = 0; x2 + y2 <= scaleSquare && (iter < maxIterations); ++iter) { + + y = 2 * x * y + y0; + x = x2 - y2 + x0; + + x2 = x * x; + y2 = y * y; + count++; + } + @SuppressWarnings("unused") int value = (256 * count) / maxIterations; + } +} +/**{OpenCL{ + typedef struct This_s{ + int width; + float scale; + int maxIterations; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int width, + float scale, + int maxIterations, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->width = width; + this->scale = scale; + this->maxIterations = maxIterations; + this->passid = passid; + { + int tid = 0; + int i = tid % this->width; + int j = tid / this->width; + float x0 = (((float)i * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float y0 = (((float)j * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float x = x0; + float y = y0; + float x2 = x * x; + float y2 = y * y; + float scaleSquare = this->scale * this->scale; + int count = 0; + for (int iter = 0; (x2 + y2)<=scaleSquare && iter<this->maxIterations; iter++){ + y = ((2.0f * x) * y) + y0; + x = (x2 - y2) + x0; + x2 = x * x; + y2 = y * y; + count++; + } + int value = (256 * count) / this->maxIterations; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitialize.java b/src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitialize.java new file mode 100644 index 00000000..a6b2d335 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitialize.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForAndMandelNoInitialize { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + int tid = 0; + + int i = tid % width; + int j = tid / width; + + float x0 = ((i * scale) - ((scale / 2) * width)) / width; + float y0 = ((j * scale) - ((scale / 2) * width)) / width; + + float x = x0; + float y = y0; + + float x2 = x * x; + float y2 = y * y; + + float scaleSquare = scale * scale; + + int count = 0; + int iter = 0; + for (; (x2 + y2 <= scaleSquare) && (iter < maxIterations); ++iter) { + + y = 2 * x * y + y0; + x = x2 - y2 + x0; + + x2 = x * x; + y2 = y * y; + count++; + } + @SuppressWarnings("unused") int value = (256 * count) / maxIterations; + } +} +/**{OpenCL{ + typedef struct This_s{ + int width; + float scale; + int maxIterations; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int width, + float scale, + int maxIterations, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->width = width; + this->scale = scale; + this->maxIterations = maxIterations; + this->passid = passid; + { + int tid = 0; + int i = tid % this->width; + int j = tid / this->width; + float x0 = (((float)i * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float y0 = (((float)j * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float x = x0; + float y = y0; + float x2 = x * x; + float y2 = y * y; + float scaleSquare = this->scale * this->scale; + int count = 0; + int iter = 0; + for (; (x2 + y2)<=scaleSquare && iter<this->maxIterations; iter++){ + y = ((2.0f * x) * y) + y0; + x = (x2 - y2) + x0; + x2 = x * x; + y2 = y * y; + count++; + } + int value = (256 * count) / this->maxIterations; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitializeTest.java b/src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitializeTest.java new file mode 100644 index 00000000..17cddbcc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAndMandelNoInitializeTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForAndMandelNoInitializeTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForAndMandelNoInitializeTest() { + test(com.aparapi.codegen.test.ForAndMandelNoInitialize.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForAndMandelNoInitializeTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForAndMandelNoInitialize.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForAndMandelTest.java b/src/test/java/com/aparapi/codegen/test/ForAndMandelTest.java new file mode 100644 index 00000000..2c80c53f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAndMandelTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForAndMandelTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForAndMandelTest() { + test(com.aparapi.codegen.test.ForAndMandel.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForAndMandelTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForAndMandel.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForAndTest.java b/src/test/java/com/aparapi/codegen/test/ForAndTest.java new file mode 100644 index 00000000..7240866f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForAndTest() { + test(com.aparapi.codegen.test.ForAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForAsFirst.java b/src/test/java/com/aparapi/codegen/test/ForAsFirst.java new file mode 100644 index 00000000..4f17e576 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAsFirst.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForAsFirst { + + public void run() { + + for (int i = 0; i < 1; i++) { + + } + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + for (int i = 0; i<1; i++){ + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForAsFirstTest.java b/src/test/java/com/aparapi/codegen/test/ForAsFirstTest.java new file mode 100644 index 00000000..84dddaf2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForAsFirstTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForAsFirstTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForAsFirstTest() { + test(com.aparapi.codegen.test.ForAsFirst.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForAsFirstTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForAsFirst.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForBooleanToggle.java b/src/test/java/com/aparapi/codegen/test/ForBooleanToggle.java new file mode 100644 index 00000000..56518c61 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForBooleanToggle.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForBooleanToggle { + public void run() { + boolean pass = false; + for (int i = 0; i > 2 && i < 10; i++) { + pass = !pass; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i>2 && i<10; i++){ + pass = (pass==0)?1:0; + } + return; + } + } + }OpenCL}**/ + +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i>2 && i<10; i++){ + pass = (pass!=0)?0:1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForBooleanToggleTest.java b/src/test/java/com/aparapi/codegen/test/ForBooleanToggleTest.java new file mode 100644 index 00000000..afbe1bf3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForBooleanToggleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForBooleanToggleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForBooleanToggleTest() { + test(com.aparapi.codegen.test.ForBooleanToggle.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForBooleanToggleTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForBooleanToggle.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForBreak.java b/src/test/java/com/aparapi/codegen/test/ForBreak.java new file mode 100644 index 00000000..f6df9d80 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForBreak.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForBreak { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i > 2 && i < 10; i++) { + pass = false; + if (i == 5 || i == 6) { + if (i == 5) { + pass = true; + break; + } + } + } + + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForBreakTest.java b/src/test/java/com/aparapi/codegen/test/ForBreakTest.java new file mode 100644 index 00000000..852ac1ad --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForBreakTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForBreakTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForBreakTest() { + test(com.aparapi.codegen.test.ForBreak.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForBreakTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForBreak.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForEach.java b/src/test/java/com/aparapi/codegen/test/ForEach.java new file mode 100644 index 00000000..6c06e275 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForEach.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForEach { + + int out[] = new int[10]; + int in[] = new int[10]; + + public void run() { + int max = Integer.MIN_VALUE; + for (int i : in) { + if (i > max) + max = i; + } + out[0] = max; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForEachTest.java b/src/test/java/com/aparapi/codegen/test/ForEachTest.java new file mode 100644 index 00000000..ed751fad --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForEachTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForEachTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForEachTest() { + test(com.aparapi.codegen.test.ForEach.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForEachTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForEach.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForIf.java b/src/test/java/com/aparapi/codegen/test/ForIf.java new file mode 100644 index 00000000..75888e1b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForIf.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForIf { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i > 2; i++) { + if (i == 3) { + pass = true; + } + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i>2; i++){ + if (i==3){ + pass = 1; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForIfMandel.java b/src/test/java/com/aparapi/codegen/test/ForIfMandel.java new file mode 100644 index 00000000..b2ac5c77 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForIfMandel.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ForIfMandel { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + int tid = 0; + + int i = tid % width; + int j = tid / width; + + float x0 = ((i * scale) - ((scale / 2) * width)) / width; + float y0 = ((j * scale) - ((scale / 2) * width)) / width; + + float x = x0; + float y = y0; + + float x2 = x * x; + float y2 = y * y; + + float scaleSquare = scale * scale; + + int count = 0; + + for (int iter = 0; iter < maxIterations; ++iter) { + if (x2 + y2 <= scaleSquare) { + y = 2 * x * y + y0; + x = x2 - y2 + x0; + + x2 = x * x; + y2 = y * y; + count++; + } else { + count--; + } + } + @SuppressWarnings("unused") int value = (256 * count) / maxIterations; + } +} +/**{OpenCL{ + typedef struct This_s{ + int width; + float scale; + int maxIterations; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int width, + float scale, + int maxIterations, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->width = width; + this->scale = scale; + this->maxIterations = maxIterations; + this->passid = passid; + { + int tid = 0; + int i = tid % this->width; + int j = tid / this->width; + float x0 = (((float)i * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float y0 = (((float)j * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float x = x0; + float y = y0; + float x2 = x * x; + float y2 = y * y; + float scaleSquare = this->scale * this->scale; + int count = 0; + for (int iter = 0; iter<this->maxIterations; iter++){ + if ((x2 + y2)<=scaleSquare){ + y = ((2.0f * x) * y) + y0; + x = (x2 - y2) + x0; + x2 = x * x; + y2 = y * y; + count++; + } else { + count--; + } + } + int value = (256 * count) / this->maxIterations; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ForIfMandelTest.java b/src/test/java/com/aparapi/codegen/test/ForIfMandelTest.java new file mode 100644 index 00000000..be67ca88 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForIfMandelTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForIfMandelTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForIfMandelTest() { + test(com.aparapi.codegen.test.ForIfMandel.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForIfMandelTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForIfMandel.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForIfTest.java b/src/test/java/com/aparapi/codegen/test/ForIfTest.java new file mode 100644 index 00000000..95a1d3c8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForIfTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForIfTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForIfTest() { + test(com.aparapi.codegen.test.ForIf.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForIfTestWorksWithCaching() { + test(com.aparapi.codegen.test.ForIf.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ForTest.java b/src/test/java/com/aparapi/codegen/test/ForTest.java new file mode 100644 index 00000000..d91894fa --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ForTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ForTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ForTest() { + test(com.aparapi.codegen.test.For.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ForTestWorksWithCaching() { + test(com.aparapi.codegen.test.For.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Frem.java b/src/test/java/com/aparapi/codegen/test/Frem.java new file mode 100644 index 00000000..51bdccd0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Frem.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Frem { + float out[] = new float[10]; + float m; + float n; + + public void run() { + out[0] = m % n; + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global float *out; + float m; + float n; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global float *out, + float m, + float n, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->m = m; + this->n = n; + this->passid = passid; + { + this->out[0] = this->m % this->n; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/FremTest.java b/src/test/java/com/aparapi/codegen/test/FremTest.java new file mode 100644 index 00000000..e2cb8d0d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/FremTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class FremTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void FremTest() { + test(com.aparapi.codegen.test.Frem.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void FremTestWorksWithCaching() { + test(com.aparapi.codegen.test.Frem.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IEEERemainderDouble.java b/src/test/java/com/aparapi/codegen/test/IEEERemainderDouble.java new file mode 100644 index 00000000..734c62fe --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IEEERemainderDouble.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class IEEERemainderDouble extends Kernel { + double out[] = new double[10]; + double m; + double n; + + public void run() { + out[0] = IEEEremainder(m, n); + } +} + +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + __global double *out; + double m; + double n; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global double *out, + double m, + double n, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->m = m; + this->n = n; + this->passid = passid; + { + this->out[0] = remainder(this->m, this->n); + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IEEERemainderDoubleTest.java b/src/test/java/com/aparapi/codegen/test/IEEERemainderDoubleTest.java new file mode 100644 index 00000000..d6a56b82 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IEEERemainderDoubleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IEEERemainderDoubleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IEEERemainderDoubleTest() { + test(com.aparapi.codegen.test.IEEERemainderDouble.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IEEERemainderDoubleTestWorksWithCaching() { + test(com.aparapi.codegen.test.IEEERemainderDouble.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IEEERemainderFloat.java b/src/test/java/com/aparapi/codegen/test/IEEERemainderFloat.java new file mode 100644 index 00000000..ac1c6864 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IEEERemainderFloat.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class IEEERemainderFloat extends Kernel { + float out[] = new float[10]; + float m; + float n; + + public void run() { + out[0] = IEEEremainder(m, n); + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global float *out; + float m; + float n; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + __global float *out, + float m, + float n, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->m = m; + this->n = n; + this->passid = passid; + { + this->out[0] = remainder(this->m, this->n); + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IEEERemainderFloatTest.java b/src/test/java/com/aparapi/codegen/test/IEEERemainderFloatTest.java new file mode 100644 index 00000000..66511edc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IEEERemainderFloatTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IEEERemainderFloatTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IEEERemainderFloatTest() { + test(com.aparapi.codegen.test.IEEERemainderFloat.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IEEERemainderFloatTestWorksWithCaching() { + test(com.aparapi.codegen.test.IEEERemainderFloat.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If.java b/src/test/java/com/aparapi/codegen/test/If.java new file mode 100644 index 00000000..0f486cbd --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 4 == 0) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ( (testValue % 4) == 0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfAnd.java b/src/test/java/com/aparapi/codegen/test/IfAnd.java new file mode 100644 index 00000000..402e0f5f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAnd.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue >= 0 && testValue < 100) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (testValue>=0 && testValue<100){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfAndAnd.java b/src/test/java/com/aparapi/codegen/test/IfAndAnd.java new file mode 100644 index 00000000..a5351341 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndAnd.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfAndAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue >= 0 && testValue < 100 && testValue == 20) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (testValue>=0 && testValue<100 && testValue==20){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfAndAndAnd.java b/src/test/java/com/aparapi/codegen/test/IfAndAndAnd.java new file mode 100644 index 00000000..af21b644 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndAndAnd.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfAndAndAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 && testValue <= 10 && testValue >= 0 && testValue % 4 == 0) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 && testValue<=10 && testValue>=0 && (testValue % 4)==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfAndAndAndTest.java b/src/test/java/com/aparapi/codegen/test/IfAndAndAndTest.java new file mode 100644 index 00000000..aef528e3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndAndAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfAndAndAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfAndAndAndTest() { + test(com.aparapi.codegen.test.IfAndAndAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfAndAndAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfAndAndAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfAndAndTest.java b/src/test/java/com/aparapi/codegen/test/IfAndAndTest.java new file mode 100644 index 00000000..cd15b208 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfAndAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfAndAndTest() { + test(com.aparapi.codegen.test.IfAndAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfAndAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfAndAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfAndOrAnd.java b/src/test/java/com/aparapi/codegen/test/IfAndOrAnd.java new file mode 100644 index 00000000..fbe98287 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndOrAnd.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfAndOrAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 && testValue <= 10 || testValue >= 0 && testValue % 4 == 0) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 && testValue<=10 || testValue>=0 && (testValue % 4)==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfAndOrAndTest.java b/src/test/java/com/aparapi/codegen/test/IfAndOrAndTest.java new file mode 100644 index 00000000..45c17836 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndOrAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfAndOrAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfAndOrAndTest() { + test(com.aparapi.codegen.test.IfAndOrAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfAndOrAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfAndOrAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfAndTest.java b/src/test/java/com/aparapi/codegen/test/IfAndTest.java new file mode 100644 index 00000000..bed08fc7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfAndTest() { + test(com.aparapi.codegen.test.IfAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAnd.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAnd.java new file mode 100644 index 00000000..134d643a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAnd.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanAndAndAnd { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a && b && c && d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 && b!=0 && c!=0 && d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAndTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAndTest.java new file mode 100644 index 00000000..c6cc2b25 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanAndAndAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanAndAndAndTest() { + test(com.aparapi.codegen.test.IfBooleanAndAndAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanAndAndAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanAndAndAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOr.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOr.java new file mode 100644 index 00000000..ca716135 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOr.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanAndAndOr { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a && b && c || d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 && b!=0 && c!=0 || d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOrTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOrTest.java new file mode 100644 index 00000000..b3d68a81 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndAndOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanAndAndOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanAndAndOrTest() { + test(com.aparapi.codegen.test.IfBooleanAndAndOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanAndAndOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanAndAndOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAnd.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAnd.java new file mode 100644 index 00000000..3abc231b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAnd.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanAndOrAnd { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a && b || c && d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 && b!=0 || c!=0 && d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAndTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAndTest.java new file mode 100644 index 00000000..bcaf567b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanAndOrAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanAndOrAndTest() { + test(com.aparapi.codegen.test.IfBooleanAndOrAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanAndOrAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanAndOrAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOr.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOr.java new file mode 100644 index 00000000..1c115933 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOr.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanAndOrOr { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a && b && c || d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 && b!=0 && c!=0 || d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOrTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOrTest.java new file mode 100644 index 00000000..13e3e637 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanAndOrOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanAndOrOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanAndOrOrTest() { + test(com.aparapi.codegen.test.IfBooleanAndOrOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanAndOrOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanAndOrOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAnd.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAnd.java new file mode 100644 index 00000000..397344a9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAnd.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanOrAndAnd { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a || b && c && d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 || b!=0 && c!=0 && d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAndTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAndTest.java new file mode 100644 index 00000000..f7e28ac3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanOrAndAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanOrAndAndTest() { + test(com.aparapi.codegen.test.IfBooleanOrAndAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanOrAndAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanOrAndAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOr.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOr.java new file mode 100644 index 00000000..09e8853c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOr.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanOrAndOr { + public void run() { + boolean a = true; + boolean b = true; + boolean c = true; + boolean d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a || b && c || d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 || b!=0 && c!=0 || d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOrTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOrTest.java new file mode 100644 index 00000000..71f4187f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrAndOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanOrAndOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanOrAndOrTest() { + test(com.aparapi.codegen.test.IfBooleanOrAndOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanOrAndOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanOrAndOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAnd.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAnd.java new file mode 100644 index 00000000..a761885b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAnd.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanOrOrAnd { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a || b || c && d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 || b!=0 || c!=0 && d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAndTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAndTest.java new file mode 100644 index 00000000..32a1a77e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanOrOrAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanOrOrAndTest() { + test(com.aparapi.codegen.test.IfBooleanOrOrAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanOrOrAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanOrOrAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOr.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOr.java new file mode 100644 index 00000000..0f8e0aec --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOr.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfBooleanOrOrOr { + public void run() { + boolean a = true, b = true, c = true, d = true; + @SuppressWarnings("unused") boolean pass = false; + + if (a || b || c || d) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if (a!=0 || b!=0 || c!=0 || d!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOrTest.java b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOrTest.java new file mode 100644 index 00000000..32f28ba5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfBooleanOrOrOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfBooleanOrOrOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfBooleanOrOrOrTest() { + test(com.aparapi.codegen.test.IfBooleanOrOrOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfBooleanOrOrOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfBooleanOrOrOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElse.java b/src/test/java/com/aparapi/codegen/test/IfElse.java new file mode 100644 index 00000000..c249e01c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElse { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 4 == 0) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ( (testValue % 4) == 0){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseAnd.java b/src/test/java/com/aparapi/codegen/test/IfElseAnd.java new file mode 100644 index 00000000..73243580 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseAnd.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElseAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue >= 0 && testValue < 100) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (testValue>=0 && testValue<100){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseAndAndAnd.java b/src/test/java/com/aparapi/codegen/test/IfElseAndAndAnd.java new file mode 100644 index 00000000..277ce435 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseAndAndAnd.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElseAndAndAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 && testValue <= 10 && testValue >= 0 && testValue % 4 == 0) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 && testValue<=10 && testValue>=0 && (testValue % 4)==0){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseAndAndAndTest.java b/src/test/java/com/aparapi/codegen/test/IfElseAndAndAndTest.java new file mode 100644 index 00000000..967ff06a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseAndAndAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseAndAndAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseAndAndAndTest() { + test(com.aparapi.codegen.test.IfElseAndAndAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseAndAndAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElseAndAndAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElseAndTest.java b/src/test/java/com/aparapi/codegen/test/IfElseAndTest.java new file mode 100644 index 00000000..94a43b40 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseAndTest() { + test(com.aparapi.codegen.test.IfElseAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElseAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElse.java b/src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElse.java new file mode 100644 index 00000000..9a76f2a5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElse.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElseIfElseIfElse { + /* + 1: istore_1 (0:iconst_1) + 3: istore_2 (2:iconst_1) + 5: istore_3 (4:iconst_1) + 7: istore 4 (6:iconst_0) + 10: ifeq 16 (9:iload_1) ? + 13: goto 39 | + + 17: ifeq 26 (16: iload_2) v | ? + 21: istore 4 (20: iconst_1) | | + 23: goto 39 | | + + 27: ifeq 36 (26: iload_3) | v | ? + 31: istore 4 (30: iconst_1) | | | + 33: goto 39 | | | + + 37: istore 4 (36: iconst_1) | | v | + 39: return v v v + */ + public void run() { + boolean a = true; + boolean b = true; + boolean c = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + } else if (b) { + result = true; + } else if (c) { + result = true; + } else { + result = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char result = 0; + if (a!=0){ + } else { + if (b!=0){ + result = 1; + } else { + if (c!=0){ + result = 1; + } else { + result = 1; + } + } + } + return; + } + } + }OpenCL}**/ +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char result = 0; + if (a==0){ + if (b!=0){ + result = 1; + } else { + if (c!=0){ + result = 1; + } else { + result = 1; + } + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElseTest.java b/src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElseTest.java new file mode 100644 index 00000000..65f3ff3b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseIfElseIfElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseIfElseIfElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseIfElseIfElseTest() { + test(com.aparapi.codegen.test.IfElseIfElseIfElse.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseIfElseIfElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElseIfElseIfElse.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_.java b/src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_.java new file mode 100644 index 00000000..69a0884c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElseNot__OrOr_And_ { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (!((testValue % 2 == 0 || testValue <= 0 || testValue >= 100) && testValue % 4 == 0)) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)!=0 && testValue>0 && testValue<100 || (testValue % 4)!=0){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_Test.java b/src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_Test.java new file mode 100644 index 00000000..e39d43ec --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseNot__OrOr_And_Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseNot__OrOr_And_Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseNot__OrOr_And_Test() { + test(com.aparapi.codegen.test.IfElseNot__OrOr_And_.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseNot__OrOr_And_TestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElseNot__OrOr_And_.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElseOrOrAnd.java b/src/test/java/com/aparapi/codegen/test/IfElseOrOrAnd.java new file mode 100644 index 00000000..b6245263 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseOrOrAnd.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElseOrOrAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 || testValue <= 0 || testValue >= 100 && testValue % 4 == 0) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 || testValue<=0 || testValue>=100 && (testValue % 4)==0){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseOrOrAndTest.java b/src/test/java/com/aparapi/codegen/test/IfElseOrOrAndTest.java new file mode 100644 index 00000000..14010141 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseOrOrAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseOrOrAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseOrOrAndTest() { + test(com.aparapi.codegen.test.IfElseOrOrAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseOrOrAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElseOrOrAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElseOrOrOr.java b/src/test/java/com/aparapi/codegen/test/IfElseOrOrOr.java new file mode 100644 index 00000000..a309754a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseOrOrOr.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElseOrOrOr { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 || testValue <= 0 || testValue >= 100 || testValue == 10) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 || testValue<=0 || testValue>=100 || testValue==10){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElseOrOrOrTest.java b/src/test/java/com/aparapi/codegen/test/IfElseOrOrOrTest.java new file mode 100644 index 00000000..a5d648e6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseOrOrOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseOrOrOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseOrOrOrTest() { + test(com.aparapi.codegen.test.IfElseOrOrOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseOrOrOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElseOrOrOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElseTest.java b/src/test/java/com/aparapi/codegen/test/IfElseTest.java new file mode 100644 index 00000000..8285d728 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElseTest() { + test(com.aparapi.codegen.test.IfElse.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElse.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElse_And_Or_And.java b/src/test/java/com/aparapi/codegen/test/IfElse_And_Or_And.java new file mode 100644 index 00000000..8f9ef569 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse_And_Or_And.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElse_And_Or_And { + public void run() { + int x = 5; + int y = 5; + + @SuppressWarnings("unused") boolean pass = false; + + if ((x >= 0 && x < 10) || (y >= 0 && y < 10)) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int x = 5; + int y = 5; + char pass = 0; + if (x>=0 && x<10 || y>=0 && y<10){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElse_And_Or_AndTest.java b/src/test/java/com/aparapi/codegen/test/IfElse_And_Or_AndTest.java new file mode 100644 index 00000000..2365020e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse_And_Or_AndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElse_And_Or_AndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElse_And_Or_AndTest() { + test(com.aparapi.codegen.test.IfElse_And_Or_And.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElse_And_Or_AndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElse_And_Or_And.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElse_OrOr_And.java b/src/test/java/com/aparapi/codegen/test/IfElse_OrOr_And.java new file mode 100644 index 00000000..5b1d6674 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse_OrOr_And.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElse_OrOr_And { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if ((testValue % 2 == 0 || testValue <= 0 || testValue >= 100) && testValue % 4 == 0) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (((testValue % 2)==0 || testValue<=0 || testValue>=100) && (testValue % 4)==0){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElse_OrOr_AndTest.java b/src/test/java/com/aparapi/codegen/test/IfElse_OrOr_AndTest.java new file mode 100644 index 00000000..0f4d72c9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse_OrOr_AndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElse_OrOr_AndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElse_OrOr_AndTest() { + test(com.aparapi.codegen.test.IfElse_OrOr_And.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElse_OrOr_AndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElse_OrOr_And.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfElse_Or_And_Or.java b/src/test/java/com/aparapi/codegen/test/IfElse_Or_And_Or.java new file mode 100644 index 00000000..34e8442e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse_Or_And_Or.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfElse_Or_And_Or { + public void run() { + int x = 5; + int y = 5; + + @SuppressWarnings("unused") boolean pass = false; + + if ((x < 0 || x >= 10) && (y < 0 || y >= 10)) { + pass = true; + } else { + pass = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int x = 5; + int y = 5; + char pass = 0; + if ((x<0 || x>=10) && (y<0 || y>=10)){ + pass = 1; + } else { + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfElse_Or_And_OrTest.java b/src/test/java/com/aparapi/codegen/test/IfElse_Or_And_OrTest.java new file mode 100644 index 00000000..da08956b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfElse_Or_And_OrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfElse_Or_And_OrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfElse_Or_And_OrTest() { + test(com.aparapi.codegen.test.IfElse_Or_And_Or.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfElse_Or_And_OrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfElse_Or_And_Or.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfOr.java b/src/test/java/com/aparapi/codegen/test/IfOr.java new file mode 100644 index 00000000..66839f15 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOr.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfOr { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue >= 0 || testValue < 100) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (testValue>=0 || testValue<100){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfOrAndOr.java b/src/test/java/com/aparapi/codegen/test/IfOrAndOr.java new file mode 100644 index 00000000..e30db4dc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrAndOr.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfOrAndOr { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 || testValue <= 0 && testValue >= 100 || testValue % 4 == 0) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 || testValue<=0 && testValue>=100 || (testValue % 4)==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfOrAndOrTest.java b/src/test/java/com/aparapi/codegen/test/IfOrAndOrTest.java new file mode 100644 index 00000000..715a9ab2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrAndOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfOrAndOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfOrAndOrTest() { + test(com.aparapi.codegen.test.IfOrAndOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfOrAndOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfOrAndOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfOrOr.java b/src/test/java/com/aparapi/codegen/test/IfOrOr.java new file mode 100644 index 00000000..14f8a706 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrOr.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfOrOr { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue >= 0 || testValue < 100 || testValue == 20) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (testValue>=0 || testValue<100 || testValue==20){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfOrOrAnd.java b/src/test/java/com/aparapi/codegen/test/IfOrOrAnd.java new file mode 100644 index 00000000..dc3091ec --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrOrAnd.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfOrOrAnd { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 || testValue <= 0 || testValue >= 100 && testValue % 4 == 0) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 || testValue<=0 || testValue>=100 && (testValue % 4)==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfOrOrAndTest.java b/src/test/java/com/aparapi/codegen/test/IfOrOrAndTest.java new file mode 100644 index 00000000..a8618ca8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrOrAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfOrOrAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfOrOrAndTest() { + test(com.aparapi.codegen.test.IfOrOrAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfOrOrAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfOrOrAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfOrOrOr.java b/src/test/java/com/aparapi/codegen/test/IfOrOrOr.java new file mode 100644 index 00000000..3d16d86b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrOrOr.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IfOrOrOr { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if (testValue % 2 == 0 || testValue <= 0 || testValue >= 100 || testValue == 10) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 || testValue<=0 || testValue>=100 || testValue==10){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IfOrOrOrTest.java b/src/test/java/com/aparapi/codegen/test/IfOrOrOrTest.java new file mode 100644 index 00000000..33b20c04 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrOrOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfOrOrOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfOrOrOrTest() { + test(com.aparapi.codegen.test.IfOrOrOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfOrOrOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfOrOrOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfOrOrTest.java b/src/test/java/com/aparapi/codegen/test/IfOrOrTest.java new file mode 100644 index 00000000..a03755d0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfOrOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfOrOrTest() { + test(com.aparapi.codegen.test.IfOrOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfOrOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfOrOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfOrTest.java b/src/test/java/com/aparapi/codegen/test/IfOrTest.java new file mode 100644 index 00000000..477c9406 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfOrTest() { + test(com.aparapi.codegen.test.IfOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.IfOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IfTest.java b/src/test/java/com/aparapi/codegen/test/IfTest.java new file mode 100644 index 00000000..c3163de0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IfTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IfTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IfTest() { + test(com.aparapi.codegen.test.If.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IfTestWorksWithCaching() { + test(com.aparapi.codegen.test.If.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_Else.java b/src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_Else.java new file mode 100644 index 00000000..bb546f8f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_Else.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_IfElseIfElseElse_Else { + public void run() { + boolean a = true; + boolean b = true; + boolean c = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + if (b) { + result = true; + } else if (c) { + result = true; + } else { + result = true; + } + } else { + result = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char result = 0; + if (a!=0){ + if (b!=0){ + result = 1; + } else { + if (c!=0){ + result = 1; + } else { + result = 1; + } + } + } else { + result = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_ElseTest.java b/src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_ElseTest.java new file mode 100644 index 00000000..1bd8ff6c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_IfElseIfElseElse_ElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_IfElseIfElseElse_ElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_IfElseIfElseElse_ElseTest() { + test(com.aparapi.codegen.test.If_IfElseIfElseElse_Else.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_IfElseIfElseElse_ElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.If_IfElseIfElseElse_Else.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_IfElse_Else.java b/src/test/java/com/aparapi/codegen/test/If_IfElse_Else.java new file mode 100644 index 00000000..db8a0425 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_IfElse_Else.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_IfElse_Else { + public void run() { + boolean a = true; + boolean b = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + if (b) { + result = true; + } else { + result = true; + } + } else { + result = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char result = 0; + if (a!=0){ + if (b!=0){ + result = 1; + } else { + result = 1; + } + } else { + result = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_IfElse_ElseTest.java b/src/test/java/com/aparapi/codegen/test/If_IfElse_ElseTest.java new file mode 100644 index 00000000..570d4ac6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_IfElse_ElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_IfElse_ElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_IfElse_ElseTest() { + test(com.aparapi.codegen.test.If_IfElse_Else.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_IfElse_ElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.If_IfElse_Else.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_.java b/src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_.java new file mode 100644 index 00000000..57e6235c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_.java @@ -0,0 +1,141 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_IfElse_Else_IfElse_ { + /* + 1: istore_1 ( 0: iconst_1) + 3: istore_2 ( 2: iconst_1) + 5: istore_3 ( 4: iconst_1) + 7: istore 4 ( 6: iconst_1) + 10: istore 5 ( 9: iconst_0) + 13: ifeq 50 (12: iload_1) ? + 17: ifeq 36 (16: iload_2) | ? + 21: ifeq 30 (20: iload_3) | | ? + 25: istore 5 (24: iconst_1) | | | + 27: goto 50 | | | + + 31: istore 5 (30: iconst_2) | | v | + 33: goto 50 | | | + + 38: ifeq 47 (36: iload 4) | v | | ? !!!!!!! + 42: istore 5 (41: iconst_3) | | | | + 44: goto 50 | | | | + + 48: istore 5 (47: iconst_4) | | | v | + 50: return v v v v + + + + 1: istore_1 ( 0: iconst_1) + 3: istore_2 ( 2: iconst_1) + 5: istore_3 ( 4: iconst_1) + 7: istore 4 ( 6: iconst_1) + 10: istore 5 ( 9: iconst_0) + 13: ifeq 50 (12: iload_1) ? + 17: ifeq 36 (16: iload_2) | ? + 21: IFELSE | | + 33: goto 50 | | | + + 38: ifeq 47 (36: iload 4) | v | | ? !!!!!!!! + 42: istore 5 (41: iconst_3) | | | | + 44: goto 50 | | | | + + 48: istore 5 (47: iconst_4) | | | v | + 50: return v v v v + + 1: istore_1 ( 0: iconst_1) + 3: istore_2 ( 2: iconst_1) + 5: istore_3 ( 4: iconst_1) + 7: istore 4 ( 6: iconst_1) + 10: istore 5 ( 9: iconst_0) + 13: ifeq 50 (12: iload_1) ? + 17: ifeq 36 (16: iload_2) | ? <---- ignore this + 21: IFELSE | | + 33: goto 50 | | + + 38: IFELSE | v | + 50: return v v + + 1: istore_1 ( 0: iconst_1) + 3: istore_2 ( 2: iconst_1) + 5: istore_3 ( 4: iconst_1) + 7: istore 4 ( 6: iconst_1) + 10: istore 5 ( 9: iconst_0) + 13: ifeq 50 (12: iload_1) ? + 21: IFELSE | + 33: goto 50 | + + 38: IFELSE | | + 50: return v v + */ + public void run() { + boolean a = true; + boolean b = true; + boolean c = true; + boolean d = true; + @SuppressWarnings("unused") int count = 0; + if (a) { + if (b) { + if (c) { + count = 1; + } else { + count = 2; + } + } else { + if (d) { + count = 3; + } else { + count = 4; + } + } + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + int count = 0; + if (a!=0){ + if (b!=0){ + if (c!=0){ + count = 1; + } else { + count = 2; + } + } else { + if (d!=0){ + count = 3; + } else { + count = 4; + } + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_Test.java b/src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_Test.java new file mode 100644 index 00000000..413015b5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_IfElse_Else_IfElse_Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_IfElse_Else_IfElse_Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_IfElse_Else_IfElse_Test() { + test(com.aparapi.codegen.test.If_IfElse_Else_IfElse_.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_IfElse_Else_IfElse_TestWorksWithCaching() { + test(com.aparapi.codegen.test.If_IfElse_Else_IfElse_.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_If_Else.java b/src/test/java/com/aparapi/codegen/test/If_If_Else.java new file mode 100644 index 00000000..5e13ad06 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_If_Else.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_If_Else { + /* + 1: istore_1 (0: iconst_1) + 3: istore_2 (2: iconst_1) + 5: istore_3 (4: iconst_0) + 7: ifeq 19 (6: iload_1) ? + 11: ifeq 21 (10: iload_2) | ? + 15: istore_3 (14: iconst_1) | | + 16: goto 21 | | + + 20: istore_3 (19: iconst_0) v | | + 21: return v v + */ + public void run() { + boolean a = true; + boolean b = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + if (b) { + result = true; + } + } else { + result = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char result = 0; + if (a!=0){ + if (b!=0){ + result = 1; + } + } else { + result = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_If_Else2.java b/src/test/java/com/aparapi/codegen/test/If_If_Else2.java new file mode 100644 index 00000000..01a6fc7d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_If_Else2.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_If_Else2 { + public void run() { + boolean a = true; + boolean b = true; + @SuppressWarnings("unused") boolean result = false; + + if (a && b) { + result = true; + } else { + result = false; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char result = 0; + if (a!=0 && b!=0){ + result = 1; + } else { + result = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_If_Else2Test.java b/src/test/java/com/aparapi/codegen/test/If_If_Else2Test.java new file mode 100644 index 00000000..3e9e70c8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_If_Else2Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_If_Else2Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_If_Else2Test() { + test(com.aparapi.codegen.test.If_If_Else2.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_If_Else2TestWorksWithCaching() { + test(com.aparapi.codegen.test.If_If_Else2.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_If_ElseTest.java b/src/test/java/com/aparapi/codegen/test/If_If_ElseTest.java new file mode 100644 index 00000000..91106ccb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_If_ElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_If_ElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_If_ElseTest() { + test(com.aparapi.codegen.test.If_If_Else.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_If_ElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.If_If_Else.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_If_Else_If_.java b/src/test/java/com/aparapi/codegen/test/If_If_Else_If_.java new file mode 100644 index 00000000..057f149d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_If_Else_If_.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_If_Else_If_ { + /* + 1: istore_1 (0:iconst_1) + 3: istore_2 (2:iconst_1) + 5: istore_3 (4:iconst_0) + 7: ifeq 19 (6:iload_1) ? + 11: ifeq 25 (10:iload_2) | ? + 15: istore_3 (14:iconst_1) | | + 16: goto 25 | | + + 20: ifeq 25 (19:iload_2) v | | ? + 24: istore_3 (23:iconst_1) | | | + 25: return v v v + */ + public void run() { + boolean a = true; + boolean b = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + if (b) { + result = true; + } + } else { + if (b) { + result = true; + } + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char result = 0; + if (a!=0){ + if (b!=0){ + result = 1; + } + } else { + if (b!=0){ + result = 1; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_If_Else_If_Test.java b/src/test/java/com/aparapi/codegen/test/If_If_Else_If_Test.java new file mode 100644 index 00000000..6729086b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_If_Else_If_Test.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_If_Else_If_Test extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_If_Else_If_Test() { + test(com.aparapi.codegen.test.If_If_Else_If_.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_If_Else_If_TestWorksWithCaching() { + test(com.aparapi.codegen.test.If_If_Else_If_.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_OrOr_And.java b/src/test/java/com/aparapi/codegen/test/If_OrOr_And.java new file mode 100644 index 00000000..c3849292 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_OrOr_And.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_OrOr_And { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if ((testValue % 2 == 0 || testValue <= 0 || testValue >= 100) && testValue % 4 == 0) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if (((testValue % 2)==0 || testValue<=0 || testValue>=100) && (testValue % 4)==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_OrOr_AndTest.java b/src/test/java/com/aparapi/codegen/test/If_OrOr_AndTest.java new file mode 100644 index 00000000..a5bd5e35 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_OrOr_AndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_OrOr_AndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_OrOr_AndTest() { + test(com.aparapi.codegen.test.If_OrOr_And.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_OrOr_AndTestWorksWithCaching() { + test(com.aparapi.codegen.test.If_OrOr_And.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_While_Else.java b/src/test/java/com/aparapi/codegen/test/If_While_Else.java new file mode 100644 index 00000000..2f37f208 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_While_Else.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_While_Else { + public void run() { + boolean a = true; + + if (a) { + while (a) { + a = false; + } + } else { + a = true; + + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + if (a!=0){ + for (; a!=0; a = 0){ + } + } else { + a = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_While_ElseTest.java b/src/test/java/com/aparapi/codegen/test/If_While_ElseTest.java new file mode 100644 index 00000000..34f4211c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_While_ElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_While_ElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_While_ElseTest() { + test(com.aparapi.codegen.test.If_While_Else.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_While_ElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.If_While_Else.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/If_While_Else_While.java b/src/test/java/com/aparapi/codegen/test/If_While_Else_While.java new file mode 100644 index 00000000..a5cf9e96 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_While_Else_While.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class If_While_Else_While { + public void run() { + boolean a = true; + + if (a) { + while (a) { + a = false; + } + } else { + while (!a) { + a = true; + } + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + if (a!=0){ + for (; a!=0; a = 0){ + } + } else { + for (; a==0; a = 1){ + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/If_While_Else_WhileTest.java b/src/test/java/com/aparapi/codegen/test/If_While_Else_WhileTest.java new file mode 100644 index 00000000..6ecc5688 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/If_While_Else_WhileTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class If_While_Else_WhileTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void If_While_Else_WhileTest() { + test(com.aparapi.codegen.test.If_While_Else_While.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void If_While_Else_WhileTestWorksWithCaching() { + test(com.aparapi.codegen.test.If_While_Else_While.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ImplementsInterface.java b/src/test/java/com/aparapi/codegen/test/ImplementsInterface.java new file mode 100644 index 00000000..4041970c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ImplementsInterface.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +interface IFoo { + public int bar(int n); +} + +public class ImplementsInterface extends Kernel implements IFoo { + int out[] = new int[1]; + + int ival = 3; + + public int bar(int n) { + return n + ival; + } + + public void run() { + out[0] = bar(1); + @SuppressWarnings("unused") boolean pass = false; + } +} +/**{OpenCL{ + typedef struct This_s{ + int ival; + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_ImplementsInterface__bar(This *this, int n){ + return((n + this->ival)); + } + __kernel void run( + int ival, + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ival = ival; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_ImplementsInterface__bar(this, 1); + char pass = 0; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ImplementsInterfaceTest.java b/src/test/java/com/aparapi/codegen/test/ImplementsInterfaceTest.java new file mode 100644 index 00000000..212115dc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ImplementsInterfaceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ImplementsInterfaceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ImplementsInterfaceTest() { + test(com.aparapi.codegen.test.ImplementsInterface.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ImplementsInterfaceTestWorksWithCaching() { + test(com.aparapi.codegen.test.ImplementsInterface.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IncArrayArgContent.java b/src/test/java/com/aparapi/codegen/test/IncArrayArgContent.java new file mode 100644 index 00000000..fdc80ecc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IncArrayArgContent.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IncArrayArgContent { + + int arr[] = new int[10]; + + public void run() { + + incit(arr); + } + + public void incit(int[] arr) { + arr[0]++; + + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *arr; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_IncArrayArgContent__incit(This *this, __global int* arr){ + arr[0] = arr[0] + 1; + return; + } + __kernel void run( + __global int *arr, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->arr = arr; + this->passid = passid; + { + com_amd_aparapi_test_IncArrayArgContent__incit(this, this->arr); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IncArrayArgContentTest.java b/src/test/java/com/aparapi/codegen/test/IncArrayArgContentTest.java new file mode 100644 index 00000000..cdf452b7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IncArrayArgContentTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IncArrayArgContentTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IncArrayArgContentTest() { + test(com.aparapi.codegen.test.IncArrayArgContent.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IncArrayArgContentTestWorksWithCaching() { + test(com.aparapi.codegen.test.IncArrayArgContent.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IncField.java b/src/test/java/com/aparapi/codegen/test/IncField.java new file mode 100644 index 00000000..66b4754c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IncField.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class IncField { + int field = 1024; + + public void run() { + field++; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IncFieldTest.java b/src/test/java/com/aparapi/codegen/test/IncFieldTest.java new file mode 100644 index 00000000..b55a7881 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IncFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IncFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IncFieldTest() { + test(com.aparapi.codegen.test.IncField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IncFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.IncField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/IndirectRecursion.java b/src/test/java/com/aparapi/codegen/test/IndirectRecursion.java new file mode 100644 index 00000000..4e5ef7a4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IndirectRecursion.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class IndirectRecursion extends Kernel { + + int intout[] = new int[1]; + + public void run() { + intout[0] = foo(10); + @SuppressWarnings("unused") boolean pass = false; + } + + int foo(int n) { + if (n > 0) { + return bar(n); + } + return -1; + } + + int bar(int n) { + return foo(--n); + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/IndirectRecursionTest.java b/src/test/java/com/aparapi/codegen/test/IndirectRecursionTest.java new file mode 100644 index 00000000..dc00394c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/IndirectRecursionTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class IndirectRecursionTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void IndirectRecursionTest() { + test(com.aparapi.codegen.test.IndirectRecursion.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void IndirectRecursionTestWorksWithCaching() { + test(com.aparapi.codegen.test.IndirectRecursion.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Interface.java b/src/test/java/com/aparapi/codegen/test/Interface.java new file mode 100644 index 00000000..ca1da431 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Interface.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Interface { + + double out[] = new double[1]; + Operator sa = new SimpleAdder(); + + public void run() { + out[0] = sa.operate(0.0); + } + + public interface Operator { + public double operate(double d); + } + + public class SimpleAdder implements Operator { + public double operate(double d) { + return d + 1.0; + } + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/InterfaceTest.java b/src/test/java/com/aparapi/codegen/test/InterfaceTest.java new file mode 100644 index 00000000..06f642b2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/InterfaceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class InterfaceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void InterfaceTest() { + test(com.aparapi.codegen.test.Interface.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void InterfaceTestWorksWithCaching() { + test(com.aparapi.codegen.test.Interface.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/LongCompare.java b/src/test/java/com/aparapi/codegen/test/LongCompare.java new file mode 100644 index 00000000..68bb343d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/LongCompare.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class LongCompare extends Kernel { + public void run() { + long n1 = 1; + long n2 = 2; + @SuppressWarnings("unused") boolean pass = false; + if (n2 > n1) + pass = true; + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + long n1 = 1L; + long n2 = 2L; + char pass = 0; + if ((n2 - n1)>0){ + pass = 1; + } + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/LongCompareTest.java b/src/test/java/com/aparapi/codegen/test/LongCompareTest.java new file mode 100644 index 00000000..3ed04f07 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/LongCompareTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class LongCompareTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void LongCompareTest() { + test(com.aparapi.codegen.test.LongCompare.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void LongCompareTestWorksWithCaching() { + test(com.aparapi.codegen.test.LongCompare.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/LongCompares.java b/src/test/java/com/aparapi/codegen/test/LongCompares.java new file mode 100644 index 00000000..60590804 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/LongCompares.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class LongCompares { + public void run() { + + @SuppressWarnings("unused") boolean pass = false; + long l1 = 1L; + long l2 = 1L; + if (l1 > l2) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + long l1 = 1L; + long l2 = 1L; + if ((l1 - l2)>0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/LongComparesTest.java b/src/test/java/com/aparapi/codegen/test/LongComparesTest.java new file mode 100644 index 00000000..18a2436e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/LongComparesTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class LongComparesTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void LongComparesTest() { + test(com.aparapi.codegen.test.LongCompares.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void LongComparesTestWorksWithCaching() { + test(com.aparapi.codegen.test.LongCompares.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Loops.java b/src/test/java/com/aparapi/codegen/test/Loops.java new file mode 100644 index 00000000..9f555540 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Loops.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Loops { + public void run() { + int sum = 0; + + for (int i = 0; i < 100; i++) { + sum = sum + ++i; + } + + for (int i = 0; i < 100; i++) { + sum = sum + i++; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int sum = 0; + for (int i = 0; i<100; i++){ + sum = sum + ++i; + } + for (int i = 0; i<100; i++){ + sum = sum + i++; + } + return; + } + } + }OpenCL}**/ + diff --git a/src/test/java/com/aparapi/codegen/test/LoopsTest.java b/src/test/java/com/aparapi/codegen/test/LoopsTest.java new file mode 100644 index 00000000..a9c44088 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/LoopsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class LoopsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void LoopsTest() { + test(com.aparapi.codegen.test.Loops.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void LoopsTestWorksWithCaching() { + test(com.aparapi.codegen.test.Loops.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MathAbs.java b/src/test/java/com/aparapi/codegen/test/MathAbs.java new file mode 100644 index 00000000..ca11d573 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathAbs.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class MathAbs extends Kernel { + public void run() { + double d = -1.0; + float f = -1.0f; + int i = -1; + long n = -1; + @SuppressWarnings("unused") boolean pass = true; + if ((abs(d) != 1) || (abs(f) != 1) || (abs(i) != 1) || (abs(n) != 1)) + pass = false; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + double d = -1.0; + float f = -1.0f; + int i = -1; + long n = -1L; + char pass = 1; + if (fabs(d)!=1.0 || fabs(f)!=1.0f || abs(i)!=1 || (abs(n) - 1L)!=0){ + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MathAbsTest.java b/src/test/java/com/aparapi/codegen/test/MathAbsTest.java new file mode 100644 index 00000000..3d0f9415 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathAbsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MathAbsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MathAbsTest() { + test(com.aparapi.codegen.test.MathAbs.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MathAbsTestWorksWithCaching() { + test(com.aparapi.codegen.test.MathAbs.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MathDegRad.java b/src/test/java/com/aparapi/codegen/test/MathDegRad.java new file mode 100644 index 00000000..676c8753 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathDegRad.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class MathDegRad extends Kernel { + public void run() { + double d = -1.0; + float f = -1.0f; + @SuppressWarnings("unused") boolean pass = true; + if ((toRadians(toDegrees(d)) != d) || (toRadians(toDegrees(f)) != f)) + pass = false; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + double d = -1.0; + float f = -1.0f; + char pass = 1; + if (radians(degrees(d))!=d || radians(degrees(f))!=f){ + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MathDegRadTest.java b/src/test/java/com/aparapi/codegen/test/MathDegRadTest.java new file mode 100644 index 00000000..8dc8a72f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathDegRadTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MathDegRadTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MathDegRadTest() { + test(com.aparapi.codegen.test.MathDegRad.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MathDegRadTestWorksWithCaching() { + test(com.aparapi.codegen.test.MathDegRad.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MathFallThru.java b/src/test/java/com/aparapi/codegen/test/MathFallThru.java new file mode 100644 index 00000000..d6b6875d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathFallThru.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class MathFallThru extends Kernel { + + long longout[] = new long[1]; + int intout[] = new int[1]; + + public void run() { + float f1 = 1.0f; + double d1 = 1.0; + longout[0] = round(ceil(cos(exp(floor(log(pow(d1, d1)))))) + tan(sqrt(sin(rint(acos(asin(atan(atan2(d1, d1))))))))); + intout[0] = round(ceil(cos(exp(floor(log(pow(f1, f1)))))) + tan(sqrt(sin(rint(acos(asin(atan(atan2(f1, f1))))))))); + @SuppressWarnings("unused") boolean pass = false; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + __global long *longout; + __global int *intout; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global long *longout, + __global int *intout, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->longout = longout; + this->intout = intout; + this->passid = passid; + { + float f1 = 1.0f; + double d1 = 1.0; + this->longout[0] = round((ceil(cos(exp(floor(log(pow(d1, d1)))))) + tan(sqrt(sin(rint(acos(asin(atan(atan2(d1, d1)))))))))); + this->intout[0] = round((ceil(cos(exp(floor(log(pow(f1, f1)))))) + tan(sqrt(sin(rint(acos(asin(atan(atan2(f1, f1)))))))))); + char pass = 0; + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MathFallThruTest.java b/src/test/java/com/aparapi/codegen/test/MathFallThruTest.java new file mode 100644 index 00000000..fb538a1d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathFallThruTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MathFallThruTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MathFallThruTest() { + test(com.aparapi.codegen.test.MathFallThru.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MathFallThruTestWorksWithCaching() { + test(com.aparapi.codegen.test.MathFallThru.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MathMax.java b/src/test/java/com/aparapi/codegen/test/MathMax.java new file mode 100644 index 00000000..9faf762c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathMax.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class MathMax extends Kernel { + public void run() { + double d1 = -1.0, d2 = 1.0; + float f1 = -1.0f, f2 = 1.0f; + int i1 = -1, i2 = 1; + long n1 = -1, n2 = 1; + @SuppressWarnings("unused") boolean pass = true; + if ((max(d1, d2) != 1) || (max(f1, f2) != 1) || (max(i1, i2) != 1) || (max(n1, n2) != 1)) + pass = false; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + double d1 = -1.0; + double d2 = 1.0; + float f1 = -1.0f; + float f2 = 1.0f; + int i1 = -1; + int i2 = 1; + long n1 = -1L; + long n2 = 1L; + char pass = 1; + if (fmax(d1, d2)!=1.0 || fmax(f1, f2)!=1.0f || max(i1, i2)!=1 || (max(n1, n2) - 1L)!=0){ + pass = 0; + } + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MathMaxTest.java b/src/test/java/com/aparapi/codegen/test/MathMaxTest.java new file mode 100644 index 00000000..2add0856 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathMaxTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MathMaxTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MathMaxTest() { + test(com.aparapi.codegen.test.MathMax.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MathMaxTestWorksWithCaching() { + test(com.aparapi.codegen.test.MathMax.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MathMin.java b/src/test/java/com/aparapi/codegen/test/MathMin.java new file mode 100644 index 00000000..fc16404f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathMin.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class MathMin extends Kernel { + public void run() { + double d1 = -1.0, d2 = 1.0; + float f1 = -1.0f, f2 = 1.0f; + int i1 = -1, i2 = 1; + long n1 = -1, n2 = 1; + @SuppressWarnings("unused") boolean pass = true; + if ((min(d1, d2) != 1) || (min(f1, f2) != 1) || (min(i1, i2) != 1) || (min(n1, n2) != 1)) + pass = false; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + double d1 = -1.0; + double d2 = 1.0; + float f1 = -1.0f; + float f2 = 1.0f; + int i1 = -1; + int i2 = 1; + long n1 = -1L; + long n2 = 1L; + char pass = 1; + if (fmin(d1, d2)!=1.0 || fmin(f1, f2)!=1.0f || min(i1, i2)!=1 || (min(n1, n2) - 1L)!=0){ + pass = 0; + } + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MathMinTest.java b/src/test/java/com/aparapi/codegen/test/MathMinTest.java new file mode 100644 index 00000000..caa22adb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathMinTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MathMinTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MathMinTest() { + test(com.aparapi.codegen.test.MathMin.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MathMinTestWorksWithCaching() { + test(com.aparapi.codegen.test.MathMin.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MathRemainder.java b/src/test/java/com/aparapi/codegen/test/MathRemainder.java new file mode 100644 index 00000000..eb377bdb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathRemainder.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class MathRemainder extends Kernel { + public void run() { + double d1 = 7.0, d2 = 2.0; + float f1 = 7.0f, f2 = 2.0f; + @SuppressWarnings("unused") boolean pass = true; + if ((IEEEremainder(d1, d2) != 1) || (IEEEremainder(f1, f2) != 1)) + pass = false; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + double d1 = 7.0; + double d2 = 2.0; + float f1 = 7.0f; + float f2 = 2.0f; + char pass = 1; + if (remainder(d1, d2)!=1.0 || remainder(f1, f2)!=1.0f){ + pass = 0; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MathRemainderTest.java b/src/test/java/com/aparapi/codegen/test/MathRemainderTest.java new file mode 100644 index 00000000..56bd0c8c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MathRemainderTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MathRemainderTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MathRemainderTest() { + test(com.aparapi.codegen.test.MathRemainder.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MathRemainderTestWorksWithCaching() { + test(com.aparapi.codegen.test.MathRemainder.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MultiContinue.java b/src/test/java/com/aparapi/codegen/test/MultiContinue.java new file mode 100644 index 00000000..8ae68a2f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MultiContinue.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class MultiContinue { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + for (int i = 0; i < 10; i++) { + if (i == 5) { + continue; + } else { + if (i == 2) { + continue; + } + if (i == 1) { + continue; + } + } + if (i == 10) { + continue; + } + pass = true; + } + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + for (int i = 0; i<10; i++){ + if (i==5){ + } else { + if (i==2){ + } else { + if (i==1){ + } else { + if (i==10){ + } else { + pass = 1; + } + } + } + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MultiContinueTest.java b/src/test/java/com/aparapi/codegen/test/MultiContinueTest.java new file mode 100644 index 00000000..54f8a66c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MultiContinueTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MultiContinueTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MultiContinueTest() { + test(com.aparapi.codegen.test.MultiContinue.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MultiContinueTestWorksWithCaching() { + test(com.aparapi.codegen.test.MultiContinue.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MultipleAssign.java b/src/test/java/com/aparapi/codegen/test/MultipleAssign.java new file mode 100644 index 00000000..fdcceaa7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MultipleAssign.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class MultipleAssign { + + public void run() { + @SuppressWarnings("unused") int a = 0; + @SuppressWarnings("unused") int b = 0; + @SuppressWarnings("unused") int c = 0; + a = b = c = 4; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int a = 0; + int b = 0; + int c = 0; + a = b = c = 4; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MultipleAssignExpr.java b/src/test/java/com/aparapi/codegen/test/MultipleAssignExpr.java new file mode 100644 index 00000000..db75c1d6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MultipleAssignExpr.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class MultipleAssignExpr { + + int sum(int lhs, int rhs) { + return (lhs + rhs); + } + + public void run() { + @SuppressWarnings("unused") int a = 0; + @SuppressWarnings("unused") int b = 0; + @SuppressWarnings("unused") int c = 0; + a = b = c = sum(1, 2); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_MultipleAssignExpr__sum(This *this, int lhs, int rhs){ + return((lhs + rhs)); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int a = 0; + int b = 0; + int c = 0; + a = b = c = com_amd_aparapi_test_MultipleAssignExpr__sum(this, 1, 2); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/MultipleAssignExprTest.java b/src/test/java/com/aparapi/codegen/test/MultipleAssignExprTest.java new file mode 100644 index 00000000..615304a3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MultipleAssignExprTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MultipleAssignExprTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MultipleAssignExprTest() { + test(com.aparapi.codegen.test.MultipleAssignExpr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MultipleAssignExprTestWorksWithCaching() { + test(com.aparapi.codegen.test.MultipleAssignExpr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/MultipleAssignTest.java b/src/test/java/com/aparapi/codegen/test/MultipleAssignTest.java new file mode 100644 index 00000000..85bcd8e1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/MultipleAssignTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class MultipleAssignTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void MultipleAssignTest() { + test(com.aparapi.codegen.test.MultipleAssign.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void MultipleAssignTestWorksWithCaching() { + test(com.aparapi.codegen.test.MultipleAssign.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/NaN.java b/src/test/java/com/aparapi/codegen/test/NaN.java new file mode 100644 index 00000000..9146e638 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NaN.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class NaN extends Kernel { + @Override + public void run() { + double d = 1.0E-10; + } +} +/**{OpenCL{ + #pragma OPENCL EXTENSION cl_khr_fp64 : enable + + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + double d = 1.0E-10; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/NaNTest.java b/src/test/java/com/aparapi/codegen/test/NaNTest.java new file mode 100644 index 00000000..0ed91ff9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NaNTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class NaNTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void NaNTest() { + test(com.aparapi.codegen.test.NaN.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void NaNTestWorksWithCaching() { + test(com.aparapi.codegen.test.NaN.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/NewLocalArray.java b/src/test/java/com/aparapi/codegen/test/NewLocalArray.java new file mode 100644 index 00000000..d45a4f57 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NewLocalArray.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class NewLocalArray { + + int array[] = new int[4]; + + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if (i++ == 0) + pass = true; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + if (i++==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/NewLocalArrayTest.java b/src/test/java/com/aparapi/codegen/test/NewLocalArrayTest.java new file mode 100644 index 00000000..4fb9aaa2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NewLocalArrayTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class NewLocalArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void NewLocalArrayTest() { + test(com.aparapi.codegen.test.NewLocalArray.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void NewLocalArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.NewLocalArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/NonNullCheck.java b/src/test/java/com/aparapi/codegen/test/NonNullCheck.java new file mode 100644 index 00000000..5e0fda90 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NonNullCheck.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class NonNullCheck { + int[] ints = new int[1024]; + + public void run() { + if (ints != null) { + int value = ints[0]; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *ints; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *ints, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ints = ints; + this->passid = passid; + { + if (this->ints != NULL){ + int value = this->ints[0]; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/NonNullCheckTest.java b/src/test/java/com/aparapi/codegen/test/NonNullCheckTest.java new file mode 100644 index 00000000..8c69e7e0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NonNullCheckTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class NonNullCheckTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void NonNullCheckTest() { + test(com.aparapi.codegen.test.NonNullCheck.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void NonNullCheckTestWorksWithCaching() { + test(com.aparapi.codegen.test.NonNullCheck.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/NullCheck.java b/src/test/java/com/aparapi/codegen/test/NullCheck.java new file mode 100644 index 00000000..7a1abf09 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NullCheck.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class NullCheck { + int[] ints = new int[1024]; + + public void run() { + if (ints == null) { + return; + } + int value = ints[0]; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *ints; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *ints, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->ints = ints; + this->passid = passid; + { + if (this->ints == NULL){ + return; + } + int value = this->ints[0]; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/NullCheckTest.java b/src/test/java/com/aparapi/codegen/test/NullCheckTest.java new file mode 100644 index 00000000..c6c0d882 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/NullCheckTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class NullCheckTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void NullCheckTest() { + test(com.aparapi.codegen.test.NullCheck.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void NullCheckTestWorksWithCaching() { + test(com.aparapi.codegen.test.NullCheck.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchy.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchy.java new file mode 100644 index 00000000..5de756a1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchy.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayCallHierarchy extends Kernel { + + final static int size = 16; + int something; + + ; + DummyOOA dummy[] = null; + + ; + + public ObjectArrayCallHierarchy() { + something = -1; + dummy = new DummyOOA[size]; + dummy[0] = new DummyOOA(); + } + + public int bar(int x) { + return -x; + } + + public void run() { + int myId = getGlobalId(); + dummy[myId].intField = bar(2) + dummy[myId].funnyGet(); + } + + static class DummyParent { + int intField; + + int field2; + + public DummyParent() { + intField = -3; + field2 = -4; + } + + public int getIntField() { + return intField; + } + + public void setIntField(int x) { + intField = x; + } + + public void call2() { + setIntField(intField + field2); + } + + } + + final static class DummyOOA extends DummyParent { + int intField; + + public void funnyCall() { + setIntField(intField + getIntField()); + call2(); + } + + public int funnyGet() { + funnyCall(); + setIntField(intField + getIntField()); + return intField + getIntField(); + } + } +} + +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchyTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchyTest.java new file mode 100644 index 00000000..4084dd85 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayCallHierarchyTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayCallHierarchyTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayCallHierarchyTest() { + test(com.aparapi.codegen.test.ObjectArrayCallHierarchy.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayCallHierarchyTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayCallHierarchy.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuper.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuper.java new file mode 100644 index 00000000..9871090f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuper.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayCommonSuper extends Kernel { + + final static int size = 16; + DummyBrother db[] = new DummyBrother[size]; + + ; + DummySister ds[] = new DummySister[size]; + + ; + + public ObjectArrayCommonSuper() { + db[0] = new DummyBrother(); + ds[0] = new DummySister(); + } + + ; + + public void run() { + int myId = getGlobalId(); + db[myId].intField = db[myId].getIntField() + db[myId].getBrosInt(); + ds[myId].intField = ds[myId].getIntField() + ds[myId].getSisInt(); + } + + static class DummyParent { + int intField; + + public DummyParent() { + intField = -3; + } + + public int getIntField() { + return intField; + } + } + + final static class DummyBrother extends DummyParent { + int brosInt; + + public int getBrosInt() { + return brosInt; + } + } + + final static class DummySister extends DummyParent { + int sisInt; + + public int getSisInt() { + return sisInt; + } + } +} + +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuperTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuperTest.java new file mode 100644 index 00000000..81fa2518 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayCommonSuperTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayCommonSuperTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayCommonSuperTest() { + test(com.aparapi.codegen.test.ObjectArrayCommonSuper.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayCommonSuperTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayCommonSuper.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccess.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccess.java new file mode 100644 index 00000000..75765b76 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccess.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayMemberAccess extends Kernel { + + final int size = 64; + + ; + int out[] = new int[2]; + + int something; + + DummyOOA dummy[] = null; + + public ObjectArrayMemberAccess() { + something = -1; + dummy = new DummyOOA[size]; + + dummy[0] = new DummyOOA(); + } + + public int getSomething() { + return something; + } + + public int bar(int x) { + return -x; + } + + public void run() { + int myId = getGlobalId(); + dummy[myId].mem = dummy[myId].mem + 2; + dummy[myId].floatField = dummy[myId].floatField + (float) 2.0; + } + + final static class DummyOOA { + int mem; + + float floatField; + + public DummyOOA() { + mem = -3; + floatField = -3; + } + + public int getMem() { + return mem; + } + + public void setMem(int x) { + mem = x; + } + + public float getFloatField() { + return floatField; + } + + public void setFloatField(float x) { + floatField = x; + } + + } +} + +/**{OpenCL{ + typedef struct com_amd_aparapi_test_ObjectArrayMemberAccess$DummyOOA_s{ + int mem; + float floatField; + + } com_amd_aparapi_test_ObjectArrayMemberAccess$DummyOOA; + + typedef struct This_s{ + __global com_amd_aparapi_test_ObjectArrayMemberAccess$DummyOOA *dummy; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global com_amd_aparapi_test_ObjectArrayMemberAccess$DummyOOA *dummy, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->dummy = dummy; + this->passid = passid; + { + int myId = get_global_id(0); + this->dummy[myId].mem=this->dummy[myId].mem + 2; + this->dummy[myId].floatField=this->dummy[myId].floatField + 2.0f; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccessTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccessTest.java new file mode 100644 index 00000000..a0668bd7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberAccessTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberAccessTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = {""}; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberAccessTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberAccess.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberAccessTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberAccess.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetter.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetter.java new file mode 100644 index 00000000..6eccfed5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetter.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayMemberBadGetter extends Kernel { + + final int size = 64; + + ; + DummyOOA dummy[] = null; + + public ObjectArrayMemberBadGetter() { + dummy = new DummyOOA[size]; + + dummy[0] = new DummyOOA(); + } + + public void run() { + int myId = getGlobalId(); + dummy[myId].setFloatField(dummy[myId].getFloatField() + (float) 2.0); + } + + final class DummyOOA { + int mem; + + float floatField; + + float theOtherFloatField; + + public float getFloatField() { + //return floatField; + return theOtherFloatField; + } + + public void setFloatField(float x) { + floatField = x; + } + } +} + +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetterTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetterTest.java new file mode 100644 index 00000000..a13c8cad --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadGetterTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberBadGetterTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberBadGetterTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberBadGetter.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberBadGetterTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberBadGetter.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetter.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetter.java new file mode 100644 index 00000000..8893df32 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetter.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayMemberBadSetter extends Kernel { + + final int size = 64; + + ; + DummyOOA dummy[] = null; + + public ObjectArrayMemberBadSetter() { + dummy = new DummyOOA[size]; + + dummy[0] = new DummyOOA(); + } + + public void run() { + int myId = getGlobalId(); + dummy[myId].setFloatField(dummy[myId].getFloatField() + (float) 2.0); + } + + final class DummyOOA { + int mem; + + float floatField; + + float theOtherFloatField; + + public float getFloatField() { + return floatField; + } + + public void setFloatField(float x) { + theOtherFloatField = x; + } + } +} + +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetterTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetterTest.java new file mode 100644 index 00000000..498bb833 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberBadSetterTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberBadSetterTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberBadSetterTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberBadSetter.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberBadSetterTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberBadSetter.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCall.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCall.java new file mode 100644 index 00000000..28eb3709 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCall.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayMemberCall extends Kernel { + + final int size = 64; + + ; + int out[] = new int[2]; + + int something; + + DummyOOA dummy[] = null; + + public ObjectArrayMemberCall() { + something = -1; + dummy = new DummyOOA[size]; + + dummy[0] = new DummyOOA(); + } + + public int getSomething() { + return something; + } + + public int bar(int x) { + return -x; + } + + public void run() { + int myId = getGlobalId(); + dummy[myId].mem = dummy[myId].addEmUp(dummy[myId].mem, 2); + int tmp = dummy[myId].addToMem(2); + int tmp2 = dummy[myId].addEmUpPlusOne(2, tmp); + } + + final static class DummyOOA { + int mem; + + public DummyOOA() { + mem = -3; + } + + public int getMem() { + return mem; + } + + public void setMem(int x) { + mem = x; + } + + public int addEmUp(int x, int y) { + return x + y; + } + + public int addToMem(int x) { + return x + mem; + } + + public int addEmUpPlusOne(int x, int y) { + return addEmUp(x, y) + 1 + getMem(); + } + } +} + +/**{OpenCL{ + typedef struct com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA_s{ + int mem; + + } com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA; + + typedef struct This_s{ + __global com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA *dummy; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__getMem( __global com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA *this){ + return(this->mem); + } + int com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addEmUp( __global com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA *this, int x, int y){ + return((x + y)); + } + int com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addEmUpPlusOne( __global com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA *this, int x, int y){ + return(((com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addEmUp(this, x, y) + 1) + com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__getMem(this))); + } + int com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addToMem( __global com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA *this, int x){ + return((x + this->mem)); + } + __kernel void run( + __global com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA *dummy, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->dummy = dummy; + this->passid = passid; + { + int myId = get_global_id(0); + this->dummy[myId].mem=com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addEmUp( &(this->dummy[myId]), this->dummy[myId].mem, 2); + int tmp = com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addToMem( &(this->dummy[myId]), 2); + int tmp2 = com_amd_aparapi_test_ObjectArrayMemberCall$DummyOOA__addEmUpPlusOne( &(this->dummy[myId]), 2, tmp); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCallTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCallTest.java new file mode 100644 index 00000000..ca92e44b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberCallTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberCallTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberCallTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberCall.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberCallTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberCall.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetter.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetter.java new file mode 100644 index 00000000..f0f6d76b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetter.java @@ -0,0 +1,234 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +final class DummyOOA { + int mem; + + float floatField; + + long longField; + + boolean boolField; + + byte byteField; + + public DummyOOA() { + mem = 8; + } + + public boolean isBoolField() { + return boolField; + } + + public boolean getBoolField() { + return boolField; + } + + public void setBoolField(boolean x) { + //boolField = x & true; + boolField = x; + } + + public int getMem() { + return mem; + } + + public void setMem(int x) { + mem = x; + } + + public float getFloatField() { + return floatField; + } + + public void setFloatField(float x) { + floatField = x; + } + + public long getLongField() { + return longField; + } + + public void setLongField(long x) { + longField = x; + } +}; + +final class TheOtherOne { + int mem; + + public TheOtherOne() { + mem = 8; + } + + public int getMem() { + return mem; + } + + public void setMem(int x) { + mem = x; + } +}; + +public class ObjectArrayMemberGetterSetter extends Kernel { + + final int size = 64; + int out[] = new int[2]; + int something; + DummyOOA dummy[] = null; + TheOtherOne other[] = null; + + public ObjectArrayMemberGetterSetter() { + something = -1; + dummy = new DummyOOA[size]; + other = new TheOtherOne[size]; + + dummy[0] = new DummyOOA(); + other[0] = new TheOtherOne(); + } + + public int getSomething() { + return something; + } + + public int bar(int x) { + return -x; + } + + public void run() { + int myId = getGlobalId(); + + int tmp = dummy[myId].getMem(); + + dummy[myId].setMem(dummy[myId].getMem() + 2); + + dummy[myId].setMem(other[myId].getMem() + getSomething()); + + other[myId].setMem(other[myId].getMem() + getSomething()); + + dummy[myId].setLongField(dummy[myId].getLongField() + 2); + + dummy[myId].setFloatField(dummy[myId].getFloatField() + (float) 2.0); + + dummy[myId].setBoolField(dummy[myId].getBoolField() | dummy[myId].isBoolField()); + + out[myId] = getSomething(); + } +} +/**{OpenCL{ + typedef struct com_amd_aparapi_test_TheOtherOne_s{ + int mem; + + } com_amd_aparapi_test_TheOtherOne; + + typedef struct com_amd_aparapi_test_DummyOOA_s{ + long longField; + float floatField; + int mem; + char boolField; + char _pad_17; + char _pad_18; + char _pad_19; + char _pad_20; + char _pad_21; + char _pad_22; + char _pad_23; + + } com_amd_aparapi_test_DummyOOA; + + typedef struct This_s{ + int something; + __global com_amd_aparapi_test_DummyOOA *dummy; + __global com_amd_aparapi_test_TheOtherOne *other; + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_DummyOOA__setBoolField( __global com_amd_aparapi_test_DummyOOA *this, char x){ + this->boolField=x; + return; + } + char com_amd_aparapi_test_DummyOOA__isBoolField( __global com_amd_aparapi_test_DummyOOA *this){ + return(this->boolField); + } + char com_amd_aparapi_test_DummyOOA__getBoolField( __global com_amd_aparapi_test_DummyOOA *this){ + return(this->boolField); + } + void com_amd_aparapi_test_DummyOOA__setFloatField( __global com_amd_aparapi_test_DummyOOA *this, float x){ + this->floatField=x; + return; + } + float com_amd_aparapi_test_DummyOOA__getFloatField( __global com_amd_aparapi_test_DummyOOA *this){ + return(this->floatField); + } + void com_amd_aparapi_test_DummyOOA__setLongField( __global com_amd_aparapi_test_DummyOOA *this, long x){ + this->longField=x; + return; + } + long com_amd_aparapi_test_DummyOOA__getLongField( __global com_amd_aparapi_test_DummyOOA *this){ + return(this->longField); + } + void com_amd_aparapi_test_TheOtherOne__setMem( __global com_amd_aparapi_test_TheOtherOne *this, int x){ + this->mem=x; + return; + } + int com_amd_aparapi_test_ObjectArrayMemberGetterSetter__getSomething(This *this){ + return(this->something); + } + int com_amd_aparapi_test_TheOtherOne__getMem( __global com_amd_aparapi_test_TheOtherOne *this){ + return(this->mem); + } + void com_amd_aparapi_test_DummyOOA__setMem( __global com_amd_aparapi_test_DummyOOA *this, int x){ + this->mem=x; + return; + } + int com_amd_aparapi_test_DummyOOA__getMem( __global com_amd_aparapi_test_DummyOOA *this){ + return(this->mem); + } + __kernel void run( + int something, + __global com_amd_aparapi_test_DummyOOA *dummy, + __global com_amd_aparapi_test_TheOtherOne *other, + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->something = something; + this->dummy = dummy; + this->other = other; + this->out = out; + this->passid = passid; + { + int myId = get_global_id(0); + int tmp = com_amd_aparapi_test_DummyOOA__getMem( &(this->dummy[myId])); + com_amd_aparapi_test_DummyOOA__setMem( &(this->dummy[myId]), (com_amd_aparapi_test_DummyOOA__getMem( &(this->dummy[myId])) + 2)); + com_amd_aparapi_test_DummyOOA__setMem( &(this->dummy[myId]), (com_amd_aparapi_test_TheOtherOne__getMem( &(this->other[myId])) + com_amd_aparapi_test_ObjectArrayMemberGetterSetter__getSomething(this))); + com_amd_aparapi_test_TheOtherOne__setMem( &(this->other[myId]), (com_amd_aparapi_test_TheOtherOne__getMem( &(this->other[myId])) + com_amd_aparapi_test_ObjectArrayMemberGetterSetter__getSomething(this))); + com_amd_aparapi_test_DummyOOA__setLongField( &(this->dummy[myId]), (com_amd_aparapi_test_DummyOOA__getLongField( &(this->dummy[myId])) + 2L)); + com_amd_aparapi_test_DummyOOA__setFloatField( &(this->dummy[myId]), (com_amd_aparapi_test_DummyOOA__getFloatField( &(this->dummy[myId])) + 2.0f)); + com_amd_aparapi_test_DummyOOA__setBoolField( &(this->dummy[myId]), (com_amd_aparapi_test_DummyOOA__getBoolField( &(this->dummy[myId])) | com_amd_aparapi_test_DummyOOA__isBoolField( &(this->dummy[myId])))); + this->out[myId] = com_amd_aparapi_test_ObjectArrayMemberGetterSetter__getSomething(this); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetterTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetterTest.java new file mode 100644 index 00000000..24bfc5cf --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberGetterSetterTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberGetterSetterTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberGetterSetterTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberGetterSetter.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberGetterSetterTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberGetterSetter.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchy.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchy.java new file mode 100644 index 00000000..a7a5354c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchy.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectArrayMemberHierarchy extends Kernel { + + final static int size = 16; + int something; + + ; + DummyOOA dummy[] = null; + + ; + + public ObjectArrayMemberHierarchy() { + something = -1; + dummy = new DummyOOA[size]; + + dummy[0] = new DummyOOA(); + } + + public int getSomething() { + return something; + } + + public int bar(int x) { + return -x; + } + + public void run() { + int myId = getGlobalId(); + dummy[myId].intField = dummy[myId].getIntField() + 2 + getSomething(); + dummy[myId].setFloatField(dummy[myId].floatField + (float) 2.0); + } + + static class DummyParent { + int intField; + + public DummyParent() { + intField = -3; + } + + public int getIntField() { + return intField; + } + + public void setIntField(int x) { + intField = x; + } + + public int foo() { + return 42 + getIntField(); + } + + } + + final static class DummyOOA extends DummyParent { + float floatField; + + public float getFloatField() { + return floatField; + } + + public void setFloatField(float x) { + floatField = x; + } + } +} + +/**{OpenCL{ + typedef struct com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA_s{ + float floatField; + int intField; + + } com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA; + + typedef struct This_s{ + int something; + __global com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA *dummy; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + void com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA__setFloatField( __global com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA *this, float x){ + this->floatField=x; + return; + } + int com_amd_aparapi_test_ObjectArrayMemberHierarchy__getSomething(This *this){ + return(this->something); + } + int com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyParent__getIntField( __global com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA *this){ + return(this->intField); + } + __kernel void run( + int something, + __global com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA *dummy, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->something = something; + this->dummy = dummy; + this->passid = passid; + { + int myId = get_global_id(0); + this->dummy[myId].intField=(com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyParent__getIntField( &(this->dummy[myId])) + 2) + com_amd_aparapi_test_ObjectArrayMemberHierarchy__getSomething(this); + com_amd_aparapi_test_ObjectArrayMemberHierarchy$DummyOOA__setFloatField( &(this->dummy[myId]), (this->dummy[myId].floatField + 2.0f)); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchyTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchyTest.java new file mode 100644 index 00000000..c6877634 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberHierarchyTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberHierarchyTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberHierarchyTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberHierarchy.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberHierarchyTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberHierarchy.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinal.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinal.java new file mode 100644 index 00000000..4fa0f874 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinal.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +class DummyOOANF { + int mem; + + float floatField; + + long longField; + + boolean boolField; + + byte byteField; + + public DummyOOANF() { + mem = 8; + } + + public boolean isBoolField() { + return boolField; + } + + public boolean getBoolField() { + return boolField; + } + + public void setBoolField(boolean x) { + //boolField = x & true; + boolField = x; + } + + public int getMem() { + return mem; + } + + public void setMem(int x) { + mem = x; + } + + public float getFloatField() { + return floatField; + } + + public void setFloatField(float x) { + floatField = x; + } + + public long getLongField() { + return longField; + } + + public void setLongField(long x) { + longField = x; + } +}; + +public class ObjectArrayMemberNotFinal extends Kernel { + + final int size = 64; + int out[] = new int[2]; + int something; + DummyOOANF dummy[] = null; + + public ObjectArrayMemberNotFinal() { + something = -1; + dummy = new DummyOOANF[size]; + + dummy[0] = new DummyOOANF(); + } + + public int getSomething() { + return something; + } + + public int bar(int x) { + return -x; + } + + public void run() { + int myId = getGlobalId(); + + int tmp = dummy[myId].getMem(); + + dummy[myId].setMem(dummy[myId].getMem() + 2); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinalTest.java b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinalTest.java new file mode 100644 index 00000000..670bc8f5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectArrayMemberNotFinalTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectArrayMemberNotFinalTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectArrayMemberNotFinalTest() { + test(com.aparapi.codegen.test.ObjectArrayMemberNotFinal.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectArrayMemberNotFinalTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectArrayMemberNotFinal.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectRefCopy.java b/src/test/java/com/aparapi/codegen/test/ObjectRefCopy.java new file mode 100644 index 00000000..34353bf6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectRefCopy.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectRefCopy extends Kernel { + + final int size = 8; + + ; + DummyOOA dummy[] = new DummyOOA[size]; + + public void run() { + int myId = getGlobalId(); + dummy[myId] = dummy[myId + 1]; + } + + final static class DummyOOA { + int mem; + + float floatField; + } +} + +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectRefCopyTest.java b/src/test/java/com/aparapi/codegen/test/ObjectRefCopyTest.java new file mode 100644 index 00000000..ed57657a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectRefCopyTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectRefCopyTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectRefCopyTest() { + test(com.aparapi.codegen.test.ObjectRefCopy.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectRefCopyTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectRefCopy.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ObjectWithinObject.java b/src/test/java/com/aparapi/codegen/test/ObjectWithinObject.java new file mode 100644 index 00000000..c288456b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectWithinObject.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class ObjectWithinObject extends Kernel { + + final int size = 8; + + ; + DummyOOA dummy[] = new DummyOOA[size]; + + public void run() { + int myId = getGlobalId(); + dummy[myId].mem = dummy[myId].next.mem + 4; + } + + final static class DummyOOA { + int mem; + + float floatField; + + DummyOOA next; + + } +} + +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ObjectWithinObjectTest.java b/src/test/java/com/aparapi/codegen/test/ObjectWithinObjectTest.java new file mode 100644 index 00000000..8ca7c5a1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ObjectWithinObjectTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ObjectWithinObjectTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ObjectWithinObjectTest() { + test(com.aparapi.codegen.test.ObjectWithinObject.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ObjectWithinObjectTestWorksWithCaching() { + test(com.aparapi.codegen.test.ObjectWithinObject.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/OrAndOrPrecedence.java b/src/test/java/com/aparapi/codegen/test/OrAndOrPrecedence.java new file mode 100644 index 00000000..6022c859 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/OrAndOrPrecedence.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class OrAndOrPrecedence { + public void run() { + boolean a = true; + boolean b = true; + boolean c = true; + boolean d = true; + @SuppressWarnings("unused") boolean pass = false; + + if ((a || b) && (c || d)) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 1; + char c = 1; + char d = 1; + char pass = 0; + if ((a!=0 || b!=0) && (c!=0 || d!=0)){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/OrAndOrPrecedenceTest.java b/src/test/java/com/aparapi/codegen/test/OrAndOrPrecedenceTest.java new file mode 100644 index 00000000..13ccf846 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/OrAndOrPrecedenceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class OrAndOrPrecedenceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void OrAndOrPrecedenceTest() { + test(com.aparapi.codegen.test.OrAndOrPrecedence.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void OrAndOrPrecedenceTestWorksWithCaching() { + test(com.aparapi.codegen.test.OrAndOrPrecedence.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/OverloadMethod.java b/src/test/java/com/aparapi/codegen/test/OverloadMethod.java new file mode 100644 index 00000000..c54ca0f1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/OverloadMethod.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class OverloadMethod extends Kernel { + int out[] = new int[1]; + + public void run() { + out[0] = foo(2) + foo(2, 3); + } + + int foo(int n) { + return n + 1; + } + + int foo(int a, int b) { + return min(a, b); + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_OverloadMethod__foo(This *this, int a, int b){ + return(min(a, b)); + } + int com_amd_aparapi_test_OverloadMethod__foo(This *this, int n){ + return((n + 1)); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_OverloadMethod__foo(this, 2) + com_amd_aparapi_test_OverloadMethod__foo(this, 2, 3); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/OverloadMethodTest.java b/src/test/java/com/aparapi/codegen/test/OverloadMethodTest.java new file mode 100644 index 00000000..904f8856 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/OverloadMethodTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class OverloadMethodTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void OverloadMethodTest() { + test(com.aparapi.codegen.test.OverloadMethod.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void OverloadMethodTestWorksWithCaching() { + test(com.aparapi.codegen.test.OverloadMethod.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/OverriddenKernelField.java b/src/test/java/com/aparapi/codegen/test/OverriddenKernelField.java new file mode 100644 index 00000000..f43a3453 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/OverriddenKernelField.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +class OverriddenKernelFieldParent extends Kernel { + int out[] = new int[1]; + + int foo(int n) { + out[0] = n + 1; + return out[0]; + } + + public void run() { + out[0] = foo(3); + } +} + +public class OverriddenKernelField extends OverriddenKernelFieldParent { + int out[] = new int[1]; + + public void run() { + out[0] = foo(2); + } + + int foo(int n) { + return super.foo(n + 1); + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_OverriddenKernelFieldParent__foo(This *this, int n){ + this->out[0] = n + 1; + return(this->out[0]); + } + int com_amd_aparapi_test_OverriddenKernelField__foo(This *this, int n){ + return(com_amd_aparapi_test_OverriddenKernelFieldParent__foo(this, (n + 1))); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_OverriddenKernelField__foo(this, 2); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/OverriddenKernelFieldTest.java b/src/test/java/com/aparapi/codegen/test/OverriddenKernelFieldTest.java new file mode 100644 index 00000000..aec126be --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/OverriddenKernelFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class OverriddenKernelFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void OverriddenKernelFieldTest() { + test(com.aparapi.codegen.test.OverriddenKernelField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void OverriddenKernelFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.OverriddenKernelField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PlayPen.java b/src/test/java/com/aparapi/codegen/test/PlayPen.java new file mode 100644 index 00000000..d494b46d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PlayPen.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PlayPen { + public void run() { + int testValue = 10; + @SuppressWarnings("unused") boolean pass = false; + + if ((testValue % 2 == 0 || testValue <= 0 && (testValue >= 100) && testValue % 4 == 0)) { + pass = true; + } + + if ((testValue < 3 || testValue > 5) && (testValue < 2 || testValue > 2) || testValue > 5) { + pass = true; + } + boolean a = false, b = false, c = false, d = false, e = false, f = false; + if ((a || b && c && d) && e || f) { + pass = true; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int testValue = 10; + char pass = 0; + if ((testValue % 2)==0 || testValue<=0 && testValue>=100 && (testValue % 4)==0){ + pass = 1; + } + if ((testValue<3 || testValue>5) && (testValue<2 || testValue>2) || testValue>5){ + pass = 1; + } + char a = 0; + char b = 0; + char c = 0; + char d = 0; + char e = 0; + char f = 0; + if ((a!=0 || b!=0 && c!=0 && d!=0) && e!=0 || f!=0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PlayPenTest.java b/src/test/java/com/aparapi/codegen/test/PlayPenTest.java new file mode 100644 index 00000000..6e921b08 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PlayPenTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PlayPenTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PlayPenTest() { + test(com.aparapi.codegen.test.PlayPen.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PlayPenTestWorksWithCaching() { + test(com.aparapi.codegen.test.PlayPen.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostDecArrayItem.java b/src/test/java/com/aparapi/codegen/test/PostDecArrayItem.java new file mode 100644 index 00000000..22adf098 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecArrayItem.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostDecArrayItem { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + + void actuallyDoIt(int a) { + + } + + public void run() { + int a = 10; + values[a] = results[a]--; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *values; + __global int *results; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *values, + __global int *results, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->results = results; + this->passid = passid; + { + int a = 10; + this->values[a] = this->results[a]--; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostDecArrayItemTest.java b/src/test/java/com/aparapi/codegen/test/PostDecArrayItemTest.java new file mode 100644 index 00000000..a08cb92f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecArrayItemTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostDecArrayItemTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostDecArrayItemTest() { + test(com.aparapi.codegen.test.PostDecArrayItem.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostDecArrayItemTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostDecArrayItem.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostDecByte.java b/src/test/java/com/aparapi/codegen/test/PostDecByte.java new file mode 100644 index 00000000..60f99941 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecByte.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostDecByte { + + /** + * This is a nonsense test, but it should be emitted correctly to return the + * original value of a + */ + byte incByte(byte a) { + return a++; + } + + public void run() { + byte startValue = (byte) 3; + @SuppressWarnings("unused") byte result = incByte(startValue--); + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + char com_amd_aparapi_test_PostDecByte__incByte(This *this, char a){ + return(a++); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char startValue = 3; + char result = com_amd_aparapi_test_PostDecByte__incByte(this, startValue--); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostDecByteTest.java b/src/test/java/com/aparapi/codegen/test/PostDecByteTest.java new file mode 100644 index 00000000..82990688 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecByteTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostDecByteTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostDecByteTest() { + test(com.aparapi.codegen.test.PostDecByte.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostDecByteTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostDecByte.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostDecLocal.java b/src/test/java/com/aparapi/codegen/test/PostDecLocal.java new file mode 100644 index 00000000..b7a301f2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecLocal.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostDecLocal { + + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if (i-- == 0) + pass = true; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + if (i--==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostDecLocalTest.java b/src/test/java/com/aparapi/codegen/test/PostDecLocalTest.java new file mode 100644 index 00000000..1cf61e6e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecLocalTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostDecLocalTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostDecLocalTest() { + test(com.aparapi.codegen.test.PostDecLocal.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostDecLocalTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostDecLocal.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostDecPostInc.java b/src/test/java/com/aparapi/codegen/test/PostDecPostInc.java new file mode 100644 index 00000000..d9208c36 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecPostInc.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostDecPostInc { + + public void run() { + int i = 0; + @SuppressWarnings("unused") int result = 0; + result = i-- + i++; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int i = 0; + int result = 0; + result = i-- + i++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostDecPostIncTest.java b/src/test/java/com/aparapi/codegen/test/PostDecPostIncTest.java new file mode 100644 index 00000000..5760f04b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostDecPostIncTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostDecPostIncTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostDecPostIncTest() { + test(com.aparapi.codegen.test.PostDecPostInc.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostDecPostIncTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostDecPostInc.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElement.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElement.java new file mode 100644 index 00000000..fc9d545e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElement.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncArrayIndexAndElement { + + int array[] = new int[4]; + + public void run() { + int i = 0; + array[i++]++; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *array; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *array, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->array = array; + this->passid = passid; + { + int i = 0; + this->array[i++] = this->array[i] + 1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElementTest.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElementTest.java new file mode 100644 index 00000000..1d98bc01 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayIndexAndElementTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncArrayIndexAndElementTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncArrayIndexAndElementTest() { + test(com.aparapi.codegen.test.PostIncArrayIndexAndElement.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncArrayIndexAndElementTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncArrayIndexAndElement.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayItem.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayItem.java new file mode 100644 index 00000000..4d2a74ab --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayItem.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncArrayItem { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + + void actuallyDoIt(int a) { + + } + + public void run() { + int a = 10; + values[a] = results[a]++; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *values; + __global int *results; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *values, + __global int *results, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->results = results; + this->passid = passid; + { + int a = 10; + this->values[a] = this->results[a]++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameter.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameter.java new file mode 100644 index 00000000..6f56a7b2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameter.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncArrayItemAsParameter { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + int y = 2; + + int actuallyDoIt(int a) { + return 1; + } + + public void run() { + actuallyDoIt(results[y]++); + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *results; + int y; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_PostIncArrayItemAsParameter__actuallyDoIt(This *this, int a){ + return(1); + } + __kernel void run( + __global int *results, + int y, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->results = results; + this->y = y; + this->passid = passid; + { + com_amd_aparapi_test_PostIncArrayItemAsParameter__actuallyDoIt(this, this->results[this->y]++); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameterTest.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameterTest.java new file mode 100644 index 00000000..cf7707ff --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemAsParameterTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncArrayItemAsParameterTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncArrayItemAsParameterTest() { + test(com.aparapi.codegen.test.PostIncArrayItemAsParameter.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncArrayItemAsParameterTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncArrayItemAsParameter.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndex.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndex.java new file mode 100644 index 00000000..e6846dce --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndex.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncArrayItemFieldIndex { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + + public int a = 10; + + public void run() { + values[a] = results[a]++; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *values; + int a; + __global int *results; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *values, + int a, + __global int *results, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->a = a; + this->results = results; + this->passid = passid; + { + this->values[this->a] = this->results[this->a]++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndexTest.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndexTest.java new file mode 100644 index 00000000..01e149c1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemFieldIndexTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncArrayItemFieldIndexTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncArrayItemFieldIndexTest() { + test(com.aparapi.codegen.test.PostIncArrayItemFieldIndex.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncArrayItemFieldIndexTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncArrayItemFieldIndex.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncArrayItemTest.java b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemTest.java new file mode 100644 index 00000000..2e93a031 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncArrayItemTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncArrayItemTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncArrayItemTest() { + test(com.aparapi.codegen.test.PostIncArrayItem.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncArrayItemTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncArrayItem.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncByte.java b/src/test/java/com/aparapi/codegen/test/PostIncByte.java new file mode 100644 index 00000000..9ff60783 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncByte.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncByte { + + /** + * This is a nonsense test, but it should be emitted correctly to return the + * original value of a + */ + byte incByte(byte a) { + return a++; + } + + public void run() { + byte startValue = (byte) 3; + @SuppressWarnings("unused") byte result = incByte(startValue++); + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + char com_amd_aparapi_test_PostIncByte__incByte(This *this, char a){ + return(a++); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char startValue = 3; + char result = com_amd_aparapi_test_PostIncByte__incByte(this, startValue++); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncByteField.java b/src/test/java/com/aparapi/codegen/test/PostIncByteField.java new file mode 100644 index 00000000..3a1625a8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncByteField.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncByteField { + + byte z = (byte) 3; + + byte incByte(byte _a) { + return _a++; + } + + public void run() { + + z = incByte(z++); + + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncByteFieldTest.java b/src/test/java/com/aparapi/codegen/test/PostIncByteFieldTest.java new file mode 100644 index 00000000..797fa05b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncByteFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncByteFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncByteFieldTest() { + test(com.aparapi.codegen.test.PostIncByteField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncByteFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncByteField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncByteTest.java b/src/test/java/com/aparapi/codegen/test/PostIncByteTest.java new file mode 100644 index 00000000..8bda1cdc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncByteTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncByteTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncByteTest() { + test(com.aparapi.codegen.test.PostIncByte.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncByteTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncByte.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncInt.java b/src/test/java/com/aparapi/codegen/test/PostIncInt.java new file mode 100644 index 00000000..923f7280 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncInt.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncInt { + + int foo(int a) { + return a; + } + + public void run() { + int y = 2; + foo(y++); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_PostIncInt__foo(This *this, int a){ + return(a); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int y = 2; + com_amd_aparapi_test_PostIncInt__foo(this,y++); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncIntField.java b/src/test/java/com/aparapi/codegen/test/PostIncIntField.java new file mode 100644 index 00000000..716dfae0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncIntField.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncIntField { + + int _y = 2; + + int incInt(int a) { + return a++; + } + + public void run() { + + incInt(_y++); + + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncIntFieldTest.java b/src/test/java/com/aparapi/codegen/test/PostIncIntFieldTest.java new file mode 100644 index 00000000..e30c8d63 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncIntFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncIntFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncIntFieldTest() { + test(com.aparapi.codegen.test.PostIncIntField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncIntFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncIntField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncIntTest.java b/src/test/java/com/aparapi/codegen/test/PostIncIntTest.java new file mode 100644 index 00000000..2bb23ad6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncIntTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncIntTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncIntTest() { + test(com.aparapi.codegen.test.PostIncInt.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncIntTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncInt.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncLocal.java b/src/test/java/com/aparapi/codegen/test/PostIncLocal.java new file mode 100644 index 00000000..fd4fb028 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncLocal.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncLocal { + + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if (i++ == 0) + pass = true; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + if (i++==0){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncLocalStandalone.java b/src/test/java/com/aparapi/codegen/test/PostIncLocalStandalone.java new file mode 100644 index 00000000..90736f95 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncLocalStandalone.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncLocalStandalone { + + public void run() { + + int i = 0; + i++; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int i = 0; + i++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncLocalStandaloneTest.java b/src/test/java/com/aparapi/codegen/test/PostIncLocalStandaloneTest.java new file mode 100644 index 00000000..66206406 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncLocalStandaloneTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncLocalStandaloneTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncLocalStandaloneTest() { + test(com.aparapi.codegen.test.PostIncLocalStandalone.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncLocalStandaloneTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncLocalStandalone.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncLocalTest.java b/src/test/java/com/aparapi/codegen/test/PostIncLocalTest.java new file mode 100644 index 00000000..56c0ad28 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncLocalTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncLocalTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncLocalTest() { + test(com.aparapi.codegen.test.PostIncLocal.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncLocalTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncLocal.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PostIncLocalTwice.java b/src/test/java/com/aparapi/codegen/test/PostIncLocalTwice.java new file mode 100644 index 00000000..bbd7c229 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncLocalTwice.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PostIncLocalTwice { + + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if (i++ + i++ == 1) + pass = true; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + if ((i++ + i++)==1){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PostIncLocalTwiceTest.java b/src/test/java/com/aparapi/codegen/test/PostIncLocalTwiceTest.java new file mode 100644 index 00000000..b7f09509 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PostIncLocalTwiceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PostIncLocalTwiceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PostIncLocalTwiceTest() { + test(com.aparapi.codegen.test.PostIncLocalTwice.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PostIncLocalTwiceTestWorksWithCaching() { + test(com.aparapi.codegen.test.PostIncLocalTwice.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElement.java b/src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElement.java new file mode 100644 index 00000000..70b16d69 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElement.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreDecArrayIndexAndElement { + + int array[] = new int[4]; + + public void run() { + int i = 0; + --array[--i]; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *array; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *array, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->array = array; + this->passid = passid; + { + int i = 0; + this->array[--i] = this->array[i] - 1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElementTest.java b/src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElementTest.java new file mode 100644 index 00000000..c8735552 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreDecArrayIndexAndElementTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreDecArrayIndexAndElementTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreDecArrayIndexAndElementTest() { + test(com.aparapi.codegen.test.PreDecArrayIndexAndElement.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreDecArrayIndexAndElementTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreDecArrayIndexAndElement.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreDecArrayItem.java b/src/test/java/com/aparapi/codegen/test/PreDecArrayItem.java new file mode 100644 index 00000000..8429c9a6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreDecArrayItem.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreDecArrayItem { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + + public void run() { + int y = 2; + values[y] = --results[y]; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *values; + __global int *results; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *values, + __global int *results, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->results = results; + this->passid = passid; + { + int y = 2; + this->values[y] = --this->results[y]; + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreDecArrayItemTest.java b/src/test/java/com/aparapi/codegen/test/PreDecArrayItemTest.java new file mode 100644 index 00000000..7e47fb3a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreDecArrayItemTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreDecArrayItemTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreDecArrayItemTest() { + test(com.aparapi.codegen.test.PreDecArrayItem.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreDecArrayItemTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreDecArrayItem.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreDecPostInc.java b/src/test/java/com/aparapi/codegen/test/PreDecPostInc.java new file mode 100644 index 00000000..b5f489cc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreDecPostInc.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreDecPostInc { + + public void run() { + int i = 0; + @SuppressWarnings("unused") int result = 0; + result = --i + i++; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int i = 0; + int result = 0; + i--; + result = i + i++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreDecPostIncTest.java b/src/test/java/com/aparapi/codegen/test/PreDecPostIncTest.java new file mode 100644 index 00000000..d9db00d8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreDecPostIncTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreDecPostIncTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreDecPostIncTest() { + test(com.aparapi.codegen.test.PreDecPostInc.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreDecPostIncTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreDecPostInc.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElement.java b/src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElement.java new file mode 100644 index 00000000..f626adf6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElement.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncArrayIndexAndElement { + + int array[] = new int[4]; + + public void run() { + int i = 0; + ++array[++i]; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *array; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *array, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->array = array; + this->passid = passid; + { + int i = 0; + this->array[++i] = this->array[i] + 1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElementTest.java b/src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElementTest.java new file mode 100644 index 00000000..fb080c0b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncArrayIndexAndElementTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncArrayIndexAndElementTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncArrayIndexAndElementTest() { + test(com.aparapi.codegen.test.PreIncArrayIndexAndElement.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncArrayIndexAndElementTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncArrayIndexAndElement.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncArrayItem.java b/src/test/java/com/aparapi/codegen/test/PreIncArrayItem.java new file mode 100644 index 00000000..7a73f5de --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncArrayItem.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncArrayItem { + + final static int START_SIZE = 128; + + public int[] values = new int[START_SIZE]; + + public int[] results = new int[START_SIZE]; + + public void run() { + int y = 2; + values[y] = ++results[y]; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *values; + __global int *results; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *values, + __global int *results, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->results = results; + this->passid = passid; + { + int y = 2; + this->values[y] = ++this->results[y]; + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncArrayItemTest.java b/src/test/java/com/aparapi/codegen/test/PreIncArrayItemTest.java new file mode 100644 index 00000000..7b8430bb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncArrayItemTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncArrayItemTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncArrayItemTest() { + test(com.aparapi.codegen.test.PreIncArrayItem.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncArrayItemTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncArrayItem.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncByte.java b/src/test/java/com/aparapi/codegen/test/PreIncByte.java new file mode 100644 index 00000000..2b6baf58 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncByte.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncByte { + + byte preIncByte(byte a) { + return ++a; + } + + public void run() { + byte initValue = 0; + @SuppressWarnings("unused") byte result = preIncByte(++initValue); + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + char com_amd_aparapi_test_PreIncByte__preIncByte(This *this, char a){ + a = (char )(a + 1); + return(a); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char initValue = 0; + char result = com_amd_aparapi_test_PreIncByte__preIncByte(this, ++initValue); + return; + } + } + }OpenCL}**/ + +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + char com_amd_aparapi_test_PreIncByte__preIncByte(This *this, char a){ + return(a=(char )(a + 1)); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char initValue = 0; + char result = com_amd_aparapi_test_PreIncByte__preIncByte(this, initValue=(char )(initValue + 1)); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncByteField.java b/src/test/java/com/aparapi/codegen/test/PreIncByteField.java new file mode 100644 index 00000000..2a7724f0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncByteField.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncByteField { + + byte z = (byte) 3; + + byte incByte(byte _a) { + return ++_a; + } + + public void run() { + + z = incByte(++z); + + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncByteFieldTest.java b/src/test/java/com/aparapi/codegen/test/PreIncByteFieldTest.java new file mode 100644 index 00000000..a583a3f8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncByteFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncByteFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncByteFieldTest() { + test(com.aparapi.codegen.test.PreIncByteField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncByteFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncByteField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncByteTest.java b/src/test/java/com/aparapi/codegen/test/PreIncByteTest.java new file mode 100644 index 00000000..8e5d4a57 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncByteTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncByteTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncByteTest() { + test(com.aparapi.codegen.test.PreIncByte.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncByteTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncByte.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncInt.java b/src/test/java/com/aparapi/codegen/test/PreIncInt.java new file mode 100644 index 00000000..8e018078 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncInt.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncInt { + + int preIncInt(int a) { + return a; + } + + public void run() { + + int y = 2; + + preIncInt(++y); + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + int com_amd_aparapi_test_PreIncInt__preIncInt(This *this, int a){ + return(a); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int y = 2; + com_amd_aparapi_test_PreIncInt__preIncInt(this,++y); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncIntField.java b/src/test/java/com/aparapi/codegen/test/PreIncIntField.java new file mode 100644 index 00000000..2e5a73b7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncIntField.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncIntField { + + int y = 2; + + int preIncInt(int _a) { + return ++_a; + } + + public void run() { + + preIncInt(++y); + + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncIntFieldTest.java b/src/test/java/com/aparapi/codegen/test/PreIncIntFieldTest.java new file mode 100644 index 00000000..bc30e352 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncIntFieldTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncIntFieldTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncIntFieldTest() { + test(com.aparapi.codegen.test.PreIncIntField.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncIntFieldTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncIntField.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncIntTest.java b/src/test/java/com/aparapi/codegen/test/PreIncIntTest.java new file mode 100644 index 00000000..fb08ef48 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncIntTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncIntTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncIntTest() { + test(com.aparapi.codegen.test.PreIncInt.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncIntTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncInt.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncLocal.java b/src/test/java/com/aparapi/codegen/test/PreIncLocal.java new file mode 100644 index 00000000..a595373a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncLocal.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncLocal { + + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if (++i == 1) + pass = true; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + i++; + if (i==1){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncLocalStandalone.java b/src/test/java/com/aparapi/codegen/test/PreIncLocalStandalone.java new file mode 100644 index 00000000..70886ab8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncLocalStandalone.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncLocalStandalone { + + public void run() { + + int i = 0; + ++i; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int i = 0; + i++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncLocalStandaloneTest.java b/src/test/java/com/aparapi/codegen/test/PreIncLocalStandaloneTest.java new file mode 100644 index 00000000..5a5eb987 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncLocalStandaloneTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncLocalStandaloneTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncLocalStandaloneTest() { + test(com.aparapi.codegen.test.PreIncLocalStandalone.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncLocalStandaloneTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncLocalStandalone.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncLocalTest.java b/src/test/java/com/aparapi/codegen/test/PreIncLocalTest.java new file mode 100644 index 00000000..cc2a25ca --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncLocalTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncLocalTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncLocalTest() { + test(com.aparapi.codegen.test.PreIncLocal.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncLocalTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncLocal.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/PreIncLocalTwice.java b/src/test/java/com/aparapi/codegen/test/PreIncLocalTwice.java new file mode 100644 index 00000000..9b8e1ebe --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncLocalTwice.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class PreIncLocalTwice { + + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + if (++i + ++i == 3) + pass = true; + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + i++; + if ((i++ + i)==3){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/PreIncLocalTwiceTest.java b/src/test/java/com/aparapi/codegen/test/PreIncLocalTwiceTest.java new file mode 100644 index 00000000..7bbbefaa --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/PreIncLocalTwiceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class PreIncLocalTwiceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void PreIncLocalTwiceTest() { + test(com.aparapi.codegen.test.PreIncLocalTwice.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void PreIncLocalTwiceTestWorksWithCaching() { + test(com.aparapi.codegen.test.PreIncLocalTwice.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArray.java b/src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArray.java new file mode 100644 index 00000000..6271a596 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArray.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnBooleanNewArray { + + boolean[] returnBooleanNewArray() { + + return new boolean[1024]; + } + + public void run() { + returnBooleanNewArray(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArrayTest.java b/src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArrayTest.java new file mode 100644 index 00000000..6c2bf359 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnBooleanNewArrayTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnBooleanNewArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnBooleanNewArrayTest() { + test(com.aparapi.codegen.test.ReturnBooleanNewArray.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnBooleanNewArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnBooleanNewArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArray.java b/src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArray.java new file mode 100644 index 00000000..757a8aa7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArray.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnBooleanVarArray { + + boolean[] returnBooleanVarArray() { + + boolean[] ba = new boolean[1024]; + + return ba; + } + + public void run() { + returnBooleanVarArray(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArrayTest.java b/src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArrayTest.java new file mode 100644 index 00000000..4568c206 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnBooleanVarArrayTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnBooleanVarArrayTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnBooleanVarArrayTest() { + test(com.aparapi.codegen.test.ReturnBooleanVarArray.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnBooleanVarArrayTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnBooleanVarArray.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnByteArrayNew.java b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayNew.java new file mode 100644 index 00000000..fe08bdc9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayNew.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnByteArrayNew { + + byte[] returnByteArrayNew() { + return new byte[1024]; + } + + public void run() { + returnByteArrayNew(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnByteArrayNewTest.java b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayNewTest.java new file mode 100644 index 00000000..8fab6de2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnByteArrayNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnByteArrayNewTest() { + test(com.aparapi.codegen.test.ReturnByteArrayNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnByteArrayNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnByteArrayNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnByteArrayVar.java b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayVar.java new file mode 100644 index 00000000..8751bfb6 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayVar.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnByteArrayVar { + + byte[] returnByteArrayVar() { + byte[] bytes = new byte[1024]; + return bytes; + } + + public void run() { + + returnByteArrayVar(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnByteArrayVarTest.java b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayVarTest.java new file mode 100644 index 00000000..75841058 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnByteArrayVarTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnByteArrayVarTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnByteArrayVarTest() { + test(com.aparapi.codegen.test.ReturnByteArrayVar.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnByteArrayVarTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnByteArrayVar.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNew.java b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNew.java new file mode 100644 index 00000000..64e3d29a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNew.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnDoubleArrayNew { + + double[] returnDoubleArrayNew() { + return new double[1024]; + } + + public void run() { + returnDoubleArrayNew(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNewTest.java b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNewTest.java new file mode 100644 index 00000000..5ced42b8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnDoubleArrayNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnDoubleArrayNewTest() { + test(com.aparapi.codegen.test.ReturnDoubleArrayNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnDoubleArrayNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnDoubleArrayNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVar.java b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVar.java new file mode 100644 index 00000000..4be6a58e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVar.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnDoubleArrayVar { + + double[] returnDoubleArrayVar() { + double[] doubles = new double[1024]; + return doubles; + } + + public void run() { + + returnDoubleArrayVar(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVarTest.java b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVarTest.java new file mode 100644 index 00000000..83738972 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnDoubleArrayVarTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnDoubleArrayVarTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnDoubleArrayVarTest() { + test(com.aparapi.codegen.test.ReturnDoubleArrayVar.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnDoubleArrayVarTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnDoubleArrayVar.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNew.java b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNew.java new file mode 100644 index 00000000..9dd36a7c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNew.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnFloatArrayNew { + + float[] returnFloatArrayNew() { + return new float[1024]; + } + + public void run() { + returnFloatArrayNew(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNewTest.java b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNewTest.java new file mode 100644 index 00000000..52667c04 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnFloatArrayNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnFloatArrayNewTest() { + test(com.aparapi.codegen.test.ReturnFloatArrayNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnFloatArrayNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnFloatArrayNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVar.java b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVar.java new file mode 100644 index 00000000..f843d65b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVar.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnFloatArrayVar { + + float[] returnFloatArrayVar() { + float[] floats = new float[1024]; + return floats; + } + + public void run() { + + returnFloatArrayVar(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVarTest.java b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVarTest.java new file mode 100644 index 00000000..944908e1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnFloatArrayVarTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnFloatArrayVarTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnFloatArrayVarTest() { + test(com.aparapi.codegen.test.ReturnFloatArrayVar.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnFloatArrayVarTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnFloatArrayVar.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnIntArrayNew.java b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayNew.java new file mode 100644 index 00000000..c8b8b1f0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayNew.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnIntArrayNew { + + int[] returnIntArrayNew() { + return new int[1024]; + } + + public void run() { + returnIntArrayNew(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnIntArrayNewTest.java b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayNewTest.java new file mode 100644 index 00000000..67d61f27 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnIntArrayNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnIntArrayNewTest() { + test(com.aparapi.codegen.test.ReturnIntArrayNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnIntArrayNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnIntArrayNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnIntArrayVar.java b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayVar.java new file mode 100644 index 00000000..172757e2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayVar.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnIntArrayVar { + + int[] returnIntArrayVar() { + int[] ints = new int[1024]; + return ints; + } + + public void run() { + + returnIntArrayVar(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnIntArrayVarTest.java b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayVarTest.java new file mode 100644 index 00000000..22f46dce --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnIntArrayVarTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnIntArrayVarTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnIntArrayVarTest() { + test(com.aparapi.codegen.test.ReturnIntArrayVar.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnIntArrayVarTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnIntArrayVar.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnLongArrayNew.java b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayNew.java new file mode 100644 index 00000000..e9143097 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayNew.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnLongArrayNew { + + long[] returnLongArrayNew() { + return new long[1024]; + } + + public void run() { + returnLongArrayNew(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnLongArrayNewTest.java b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayNewTest.java new file mode 100644 index 00000000..1494821d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnLongArrayNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnLongArrayNewTest() { + test(com.aparapi.codegen.test.ReturnLongArrayNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnLongArrayNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnLongArrayNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnLongArrayVar.java b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayVar.java new file mode 100644 index 00000000..31edd946 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayVar.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnLongArrayVar { + + long[] returnLongArrayVar() { + long[] longs = new long[1024]; + return longs; + } + + public void run() { + + returnLongArrayVar(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnLongArrayVarTest.java b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayVarTest.java new file mode 100644 index 00000000..9b358a7d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnLongArrayVarTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnLongArrayVarTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnLongArrayVarTest() { + test(com.aparapi.codegen.test.ReturnLongArrayVar.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnLongArrayVarTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnLongArrayVar.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnPostIncInt.java b/src/test/java/com/aparapi/codegen/test/ReturnPostIncInt.java new file mode 100644 index 00000000..905f145e --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnPostIncInt.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnPostIncInt { + + int returnPostIncInt(int value) { + + return value++; + } + + public void run() { + returnPostIncInt(3); + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_ReturnPostIncInt__returnPostIncInt(This *this, int value){ + return(value++); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + com_amd_aparapi_test_ReturnPostIncInt__returnPostIncInt(this, 3); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnPostIncIntTest.java b/src/test/java/com/aparapi/codegen/test/ReturnPostIncIntTest.java new file mode 100644 index 00000000..34f549ed --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnPostIncIntTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnPostIncIntTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnPostIncIntTest() { + test(com.aparapi.codegen.test.ReturnPostIncInt.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnPostIncIntTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnPostIncInt.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnPreIncInt.java b/src/test/java/com/aparapi/codegen/test/ReturnPreIncInt.java new file mode 100644 index 00000000..d807512a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnPreIncInt.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnPreIncInt { + + int returnPreIncInt(int value) { + + return ++value; + } + + public void run() { + returnPreIncInt(3); + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_ReturnPreIncInt__returnPreIncInt(This *this, int value){ + value++; + return(value); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + com_amd_aparapi_test_ReturnPreIncInt__returnPreIncInt(this, 3); + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnPreIncIntTest.java b/src/test/java/com/aparapi/codegen/test/ReturnPreIncIntTest.java new file mode 100644 index 00000000..ea509daf --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnPreIncIntTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnPreIncIntTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnPreIncIntTest() { + test(com.aparapi.codegen.test.ReturnPreIncInt.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnPreIncIntTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnPreIncInt.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnShortArrayNew.java b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayNew.java new file mode 100644 index 00000000..c3abc039 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayNew.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnShortArrayNew { + + short[] returnShortArrayNew() { + return new short[1024]; + } + + public void run() { + returnShortArrayNew(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnShortArrayNewTest.java b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayNewTest.java new file mode 100644 index 00000000..7415307b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnShortArrayNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnShortArrayNewTest() { + test(com.aparapi.codegen.test.ReturnShortArrayNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnShortArrayNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnShortArrayNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/ReturnShortArrayVar.java b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayVar.java new file mode 100644 index 00000000..07d590bd --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayVar.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class ReturnShortArrayVar { + + short[] returnShortArrayVar() { + short[] shorts = new short[1024]; + return shorts; + } + + public void run() { + + returnShortArrayVar(); + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/ReturnShortArrayVarTest.java b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayVarTest.java new file mode 100644 index 00000000..e02e8dc3 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/ReturnShortArrayVarTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class ReturnShortArrayVarTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void ReturnShortArrayVarTest() { + test(com.aparapi.codegen.test.ReturnShortArrayVar.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void ReturnShortArrayVarTestWorksWithCaching() { + test(com.aparapi.codegen.test.ReturnShortArrayVar.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/RightShifts.java b/src/test/java/com/aparapi/codegen/test/RightShifts.java new file mode 100644 index 00000000..2a5c1558 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/RightShifts.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class RightShifts extends Kernel { + + int iout[] = new int[10]; + + int i1, i2; + + public void run() { + iout[1] = i1 >> i2; + iout[2] = i1 >>> i2; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *iout; + int i1; + int i2; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *iout, + int i1, + int i2, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->iout = iout; + this->i1 = i1; + this->i2 = i2; + this->passid = passid; + { + this->iout[1] = this->i1 >> this->i2; + this->iout[2] = ((unsigned int)this->i1) >> this->i2; + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/RightShiftsTest.java b/src/test/java/com/aparapi/codegen/test/RightShiftsTest.java new file mode 100644 index 00000000..3f168385 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/RightShiftsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class RightShiftsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void RightShiftsTest() { + test(com.aparapi.codegen.test.RightShifts.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void RightShiftsTestWorksWithCaching() { + test(com.aparapi.codegen.test.RightShifts.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Sequence.java b/src/test/java/com/aparapi/codegen/test/Sequence.java new file mode 100644 index 00000000..d2afaeb7 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Sequence.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Sequence { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/SequenceTest.java b/src/test/java/com/aparapi/codegen/test/SequenceTest.java new file mode 100644 index 00000000..3437d5a5 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/SequenceTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class SequenceTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void SequenceTest() { + test(com.aparapi.codegen.test.Sequence.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void SequenceTestWorksWithCaching() { + test(com.aparapi.codegen.test.Sequence.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/StaticFieldStore.java b/src/test/java/com/aparapi/codegen/test/StaticFieldStore.java new file mode 100644 index 00000000..b6f881cc --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/StaticFieldStore.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class StaticFieldStore { + static int foo = 6; + int[] ints = new int[1024]; + + public void run() { + foo = ints[0]; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/StaticFieldStoreTest.java b/src/test/java/com/aparapi/codegen/test/StaticFieldStoreTest.java new file mode 100644 index 00000000..5e12e0b1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/StaticFieldStoreTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class StaticFieldStoreTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void StaticFieldStoreTest() { + test(com.aparapi.codegen.test.StaticFieldStore.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void StaticFieldStoreTestWorksWithCaching() { + test(com.aparapi.codegen.test.StaticFieldStore.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/StaticMethodCall.java b/src/test/java/com/aparapi/codegen/test/StaticMethodCall.java new file mode 100644 index 00000000..2b069e19 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/StaticMethodCall.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class StaticMethodCall extends Kernel { + int out[] = new int[1]; + + public static int add(int i, int j) { + return i + j; + } + + public void run() { + out[0] = add(1, 2); + } +} + +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + int com_amd_aparapi_test_StaticMethodCall__add(int i, int j){ + return((i + j)); + } + __kernel void run( + __global int *out, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->passid = passid; + { + this->out[0] = com_amd_aparapi_test_StaticMethodCall__add(1, 2); + return; + } + } + + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/StaticMethodCallTest.java b/src/test/java/com/aparapi/codegen/test/StaticMethodCallTest.java new file mode 100644 index 00000000..5540106f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/StaticMethodCallTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class StaticMethodCallTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void StaticMethodCallTest() { + test(com.aparapi.codegen.test.StaticMethodCall.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void StaticMethodCallTestWorksWithCaching() { + test(com.aparapi.codegen.test.StaticMethodCall.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/SynchronizedMethods.java b/src/test/java/com/aparapi/codegen/test/SynchronizedMethods.java new file mode 100644 index 00000000..5150000d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/SynchronizedMethods.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class SynchronizedMethods { + int[] ints = new int[1024]; + + synchronized int doIt(int a) { + return (int) (((int) 1) - a); + } + + int doIt2(int a) { + return (int) (((int) 1) - a); + } + + public void run() { + int foo = 1; + for (int i = 0; i < 1024; i++) { + if (i % 2 == 0) { + ints[i] = doIt(i); + } else { + synchronized (this) { + ints[i] = doIt2(foo); + } + } + } + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/SynchronizedMethodsTest.java b/src/test/java/com/aparapi/codegen/test/SynchronizedMethodsTest.java new file mode 100644 index 00000000..694d8017 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/SynchronizedMethodsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class SynchronizedMethodsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void SynchronizedMethodsTest() { + test(com.aparapi.codegen.test.SynchronizedMethods.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void SynchronizedMethodsTestWorksWithCaching() { + test(com.aparapi.codegen.test.SynchronizedMethods.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/Ternary.java b/src/test/java/com/aparapi/codegen/test/Ternary.java new file mode 100644 index 00000000..fe58ebc0 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/Ternary.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class Ternary { + + float random() { + return (.1f); + } + + public void run() { + @SuppressWarnings("unused") int count = (random() > .5f) ? +1 : -1; + @SuppressWarnings("unused") int foo = 3; + } + +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + float com_amd_aparapi_test_Ternary__random(This *this){ + return(0.1f); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int count = (com_amd_aparapi_test_Ternary__random(this)>0.5f)?1:-1; + int foo = 3; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/TernaryAnd.java b/src/test/java/com/aparapi/codegen/test/TernaryAnd.java new file mode 100644 index 00000000..20866296 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryAnd.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class TernaryAnd { + float random() { + return (.1f); + } + + public void run() { + + @SuppressWarnings("unused") int count = ((random()) > .8f) && ((random()) < .2f) ? +1 : -1; + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + float com_amd_aparapi_test_TernaryAnd__random(This *this){ + return(0.1f); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int count = (com_amd_aparapi_test_TernaryAnd__random(this)>0.8f && com_amd_aparapi_test_TernaryAnd__random(this)<0.2f)?1:-1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/TernaryAndOr.java b/src/test/java/com/aparapi/codegen/test/TernaryAndOr.java new file mode 100644 index 00000000..c5c9b7a4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryAndOr.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class TernaryAndOr { + float random() { + return (.1f); + } + + public void run() { + + @SuppressWarnings("unused") int count = random() == 0.f && (random() > .8f) || (random() < .2f) ? +1 : -1; + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + float com_amd_aparapi_test_TernaryAndOr__random(This *this){ + return(0.1f); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int count = (com_amd_aparapi_test_TernaryAndOr__random(this)==0.0f && com_amd_aparapi_test_TernaryAndOr__random(this)>0.8f || com_amd_aparapi_test_TernaryAndOr__random(this)<0.2f)?1:-1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/TernaryAndOrTest.java b/src/test/java/com/aparapi/codegen/test/TernaryAndOrTest.java new file mode 100644 index 00000000..366eeb81 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryAndOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class TernaryAndOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void TernaryAndOrTest() { + test(com.aparapi.codegen.test.TernaryAndOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void TernaryAndOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.TernaryAndOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/TernaryAndTest.java b/src/test/java/com/aparapi/codegen/test/TernaryAndTest.java new file mode 100644 index 00000000..40523f63 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryAndTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class TernaryAndTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void TernaryAndTest() { + test(com.aparapi.codegen.test.TernaryAnd.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void TernaryAndTestWorksWithCaching() { + test(com.aparapi.codegen.test.TernaryAnd.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/TernaryNested.java b/src/test/java/com/aparapi/codegen/test/TernaryNested.java new file mode 100644 index 00000000..2196f900 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryNested.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class TernaryNested { + public void run() { + boolean a = false, b = false, c = false; + @SuppressWarnings("unused") int count = a ? b ? 1 : 2 : c ? 3 : 4; + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 0; + char b = 0; + char c = 0; + int count = (a!=0)?(b!=0)?1:2:(c!=0)?3:4; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/TernaryNestedTest.java b/src/test/java/com/aparapi/codegen/test/TernaryNestedTest.java new file mode 100644 index 00000000..4f770a67 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryNestedTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class TernaryNestedTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void TernaryNestedTest() { + test(com.aparapi.codegen.test.TernaryNested.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void TernaryNestedTestWorksWithCaching() { + test(com.aparapi.codegen.test.TernaryNested.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/TernaryOr.java b/src/test/java/com/aparapi/codegen/test/TernaryOr.java new file mode 100644 index 00000000..96abda1b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryOr.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class TernaryOr { + float random() { + return (.1f); + } + + public void run() { + + @SuppressWarnings("unused") int count = (random() > .8f || random() < .2f) ? +1 : -1; + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + float com_amd_aparapi_test_TernaryOr__random(This *this){ + return(0.1f); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int count = (com_amd_aparapi_test_TernaryOr__random(this)>0.8f || com_amd_aparapi_test_TernaryOr__random(this)<0.2f)?1:-1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/TernaryOrTest.java b/src/test/java/com/aparapi/codegen/test/TernaryOrTest.java new file mode 100644 index 00000000..03b90438 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryOrTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class TernaryOrTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void TernaryOrTest() { + test(com.aparapi.codegen.test.TernaryOr.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void TernaryOrTestWorksWithCaching() { + test(com.aparapi.codegen.test.TernaryOr.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/TernaryTest.java b/src/test/java/com/aparapi/codegen/test/TernaryTest.java new file mode 100644 index 00000000..303965c4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TernaryTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class TernaryTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void TernaryTest() { + test(com.aparapi.codegen.test.Ternary.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void TernaryTestWorksWithCaching() { + test(com.aparapi.codegen.test.Ternary.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/TwoForLoops.java b/src/test/java/com/aparapi/codegen/test/TwoForLoops.java new file mode 100644 index 00000000..10977d55 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TwoForLoops.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class TwoForLoops extends Kernel { + final int size = 100; + int a[] = new int[size]; + + public void run() { + for (int i = 0; i < size; i++) { + a[i] = i; + } + + int sum = 0; + for (int i = 0; i < size; i++) { + sum += a[i]; + } + } + +} +/**{OpenCL{ + typedef struct This_s{ + __global int *a; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *a, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->a = a; + this->passid = passid; + { + for (int i = 0; i<100; i++){ + this->a[i] = i; + } + int sum = 0; + for (int i = 0; i<100; i++){ + sum = sum + this->a[i]; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/TwoForLoopsTest.java b/src/test/java/com/aparapi/codegen/test/TwoForLoopsTest.java new file mode 100644 index 00000000..124a3c4d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/TwoForLoopsTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class TwoForLoopsTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void TwoForLoopsTest() { + test(com.aparapi.codegen.test.TwoForLoops.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void TwoForLoopsTestWorksWithCaching() { + test(com.aparapi.codegen.test.TwoForLoops.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByte.java b/src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByte.java new file mode 100644 index 00000000..e004359a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByte.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class UnrelatedIfElsesWithCommonEndByte { + /* + 1: istore_1 (0:iconst_1) + 3: istore_2 (2:iconst_0) + 5: istore_3 (4:iconst_1) + 7: istore 4 (6:iconst_0) + 10: ifeq 39 (9:iload_1) ? + 14: ifeq 23 (13:iload_2) | ? + 18: istore 4 (17:iconst_1) | | + 20: goto 26 | | + + 24: istore 4 (23: iconst_0) | v | + 27: ifeq 36 (26: iload_3) | v ? + 31: istore 4 (30: iconst_1) | | + 33: goto 39 | | + + 37: istore 4 (36: iconst_0) | v | + 39: return v v + */ + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + boolean a = true; + boolean b = false; + boolean c = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + if (b) { + result = true; + } else { + result = false; + } + + if (c) { + result = true; + } else { + result = false; + } + } + + } + +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 0; + char c = 1; + char result = 0; + if (a!=0){ + if (b!=0){ + result = 1; + } else { + result = 0; + } + if (c!=0){ + result = 1; + } else { + result = 0; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByteTest.java b/src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByteTest.java new file mode 100644 index 00000000..26b92dce --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UnrelatedIfElsesWithCommonEndByteTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UnrelatedIfElsesWithCommonEndByteTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UnrelatedIfElsesWithCommonEndByteTest() { + test(com.aparapi.codegen.test.UnrelatedIfElsesWithCommonEndByte.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UnrelatedIfElsesWithCommonEndByteTestWorksWithCaching() { + test(com.aparapi.codegen.test.UnrelatedIfElsesWithCommonEndByte.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByte.java b/src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByte.java new file mode 100644 index 00000000..5ff8f771 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByte.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class UnrelatedIfsWithCommonEndByte { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + boolean a1 = true; + boolean a2 = true; + boolean b = false; + boolean c = true; + boolean outer = true; + @SuppressWarnings("unused") boolean result = false; + if (outer) { + if (a1 && !a2) { + // result = true; + if (b) { + result = true; + } + //result = false; + if (c) { + result = true; + } + // result = false; + } + } + + } + +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a1 = 1; + char a2 = 1; + char b = 0; + char c = 1; + char outer = 1; + char result = 0; + if (outer!=0 && a1!=0 && a2==0){ + if (b!=0){ + result = 1; + } + if (c!=0){ + result = 1; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByteTest.java b/src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByteTest.java new file mode 100644 index 00000000..e45e2632 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UnrelatedIfsWithCommonEndByteTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UnrelatedIfsWithCommonEndByteTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UnrelatedIfsWithCommonEndByteTest() { + test(com.aparapi.codegen.test.UnrelatedIfsWithCommonEndByte.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UnrelatedIfsWithCommonEndByteTestWorksWithCaching() { + test(com.aparapi.codegen.test.UnrelatedIfsWithCommonEndByte.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElses.java b/src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElses.java new file mode 100644 index 00000000..b072bc70 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElses.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class UnrelatedNestedIfElses { + + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + boolean a = true; + boolean b = false; + boolean c = true; + @SuppressWarnings("unused") boolean result = false; + + if (a) { + if (b) { + result = true; + } else { + result = false; + } + } else { + if (c) { + result = true; + } else { + result = false; + } + } + + } + +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char a = 1; + char b = 0; + char c = 1; + char result = 0; + if (a!=0){ + if (b!=0){ + result = 1; + } else { + result = 0; + } + }else{ + if (c!=0){ + result = 1; + } else { + result = 0; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElsesTest.java b/src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElsesTest.java new file mode 100644 index 00000000..4e83b392 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UnrelatedNestedIfElsesTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UnrelatedNestedIfElsesTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UnrelatedNestedIfElsesTest() { + test(com.aparapi.codegen.test.UnrelatedNestedIfElses.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UnrelatedNestedIfElsesTestWorksWithCaching() { + test(com.aparapi.codegen.test.UnrelatedNestedIfElses.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UseObject.java b/src/test/java/com/aparapi/codegen/test/UseObject.java new file mode 100644 index 00000000..8979c148 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UseObject.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class UseObject extends Kernel { + Dummy dummy = new Dummy(); + + ; + int out[] = new int[2]; + int plainInt = -1; + + public void run() { + out[0] = dummy.n; + out[1] = plainInt; + } + + class Dummy { + public int n; + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UseObjectArrayLength.java b/src/test/java/com/aparapi/codegen/test/UseObjectArrayLength.java new file mode 100644 index 00000000..84d0faf9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UseObjectArrayLength.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class UseObjectArrayLength extends Kernel { + int out[] = new int[2]; + + ; + Dummy dummy[] = new Dummy[10]; + + public void run() { + out[0] = dummy.length; + } + + final class Dummy { + public int n; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global int *out; + __global com_amd_aparapi_test_UseObjectArrayLength$Dummy *dummy; + int dummy__javaArrayLength; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + __global int *out, + __global com_amd_aparapi_test_UseObjectArrayLength$Dummy *dummy, + int dummy__javaArrayLength, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->out = out; + this->dummy = dummy; + this->dummy__javaArrayLength = dummy__javaArrayLength; + this->passid = passid; + { + this->out[0] = this->dummy__javaArrayLength; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UseObjectArrayLengthTest.java b/src/test/java/com/aparapi/codegen/test/UseObjectArrayLengthTest.java new file mode 100644 index 00000000..807ffbbd --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UseObjectArrayLengthTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UseObjectArrayLengthTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UseObjectArrayLengthTest() { + test(com.aparapi.codegen.test.UseObjectArrayLength.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UseObjectArrayLengthTestWorksWithCaching() { + test(com.aparapi.codegen.test.UseObjectArrayLength.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UseObjectTest.java b/src/test/java/com/aparapi/codegen/test/UseObjectTest.java new file mode 100644 index 00000000..5f2d7445 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UseObjectTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UseObjectTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UseObjectTest() { + test(com.aparapi.codegen.test.UseObject.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UseObjectTestWorksWithCaching() { + test(com.aparapi.codegen.test.UseObject.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UsesArrayLength.java b/src/test/java/com/aparapi/codegen/test/UsesArrayLength.java new file mode 100644 index 00000000..255581eb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UsesArrayLength.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import com.aparapi.Kernel; + +public class UsesArrayLength extends Kernel { + + boolean[] values; + + boolean[] results; + + boolean[] results2; + + boolean actuallyDoIt(int index) { + int x = 0; + + // in array index + @SuppressWarnings("unused") boolean y = values[values.length - index]; + + // in addition + x = index + results.length; + + // in subtraction + return (results.length - x > 0); + } + + public void run() { + int myId = 0; + + // in comparison + boolean x = (values.length > 0); + + // in bit AND and as argument + results[myId] = x & actuallyDoIt(values.length); + + // Note results2.length is not used so there should not + // be a results2__javaArrayLength in the emitted source + results2[myId] = !results[myId]; + } +} +/**{OpenCL{ + typedef struct This_s{ + __global char *values; + int values__javaArrayLength; + __global char *results; + int results__javaArrayLength; + __global char *results2; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + char com_amd_aparapi_test_UsesArrayLength__actuallyDoIt(This *this, int index){ + int x = 0; + char y = this->values[(this->values__javaArrayLength - index)]; + x = index + this->results__javaArrayLength; + return(((this->results__javaArrayLength - x)>0)?1:0); + } + __kernel void run( + __global char *values, + int values__javaArrayLength, + __global char *results, + int results__javaArrayLength, + __global char *results2, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->values__javaArrayLength = values__javaArrayLength; + this->results = results; + this->results__javaArrayLength = results__javaArrayLength; + this->results2 = results2; + this->passid = passid; + { + int myId = 0; + char x = (this->values__javaArrayLength>0)?1:0; + this->results[myId] = x & com_amd_aparapi_test_UsesArrayLength__actuallyDoIt(this, this->values__javaArrayLength); + this->results2[myId] = (this->results[myId]==0)?1:0; + return; + } + } + }OpenCL}**/ + +/**{OpenCL{ + typedef struct This_s{ + __global char *values; + int values__javaArrayLength; + __global char *results; + int results__javaArrayLength; + __global char *results2; + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + char com_amd_aparapi_test_UsesArrayLength__actuallyDoIt(This *this, int index){ + int x = 0; + char y = this->values[(this->values__javaArrayLength - index)]; + x = index + this->results__javaArrayLength; + if ((this->results__javaArrayLength - x)>0){ + return(1); + } + return(0); + } + __kernel void run( + __global char *values, + int values__javaArrayLength, + __global char *results, + int results__javaArrayLength, + __global char *results2, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->values = values; + this->values__javaArrayLength = values__javaArrayLength; + this->results = results; + this->results__javaArrayLength = results__javaArrayLength; + this->results2 = results2; + this->passid = passid; + { + int myId = 0; + char x = (this->values__javaArrayLength>0)?1:0; + this->results[myId] = x & com_amd_aparapi_test_UsesArrayLength__actuallyDoIt(this, this->values__javaArrayLength); + this->results2[myId] = (this->results[myId]!=0)?0:1; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UsesArrayLengthTest.java b/src/test/java/com/aparapi/codegen/test/UsesArrayLengthTest.java new file mode 100644 index 00000000..3de63e8d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UsesArrayLengthTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UsesArrayLengthTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UsesArrayLengthTest() { + test(com.aparapi.codegen.test.UsesArrayLength.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UsesArrayLengthTestWorksWithCaching() { + test(com.aparapi.codegen.test.UsesArrayLength.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UsesNew.java b/src/test/java/com/aparapi/codegen/test/UsesNew.java new file mode 100644 index 00000000..57f3252b --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UsesNew.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class UsesNew { + int[] ints = new int[1024]; + + public void run() { + @SuppressWarnings("unused") int foo = 1; + + ints = new int[128]; + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UsesNewTest.java b/src/test/java/com/aparapi/codegen/test/UsesNewTest.java new file mode 100644 index 00000000..3f5e7365 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UsesNewTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UsesNewTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UsesNewTest() { + test(com.aparapi.codegen.test.UsesNew.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UsesNewTestWorksWithCaching() { + test(com.aparapi.codegen.test.UsesNew.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/UsesThrow.java b/src/test/java/com/aparapi/codegen/test/UsesThrow.java new file mode 100644 index 00000000..d6bcb9b4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UsesThrow.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class UsesThrow { + int[] ints = new int[1024]; + + int doIt(int a) throws Exception { + if (a < 0) { + throw new Exception("Zoinks!"); + } + return (int) (((int) 1) - a); + } + + public void run() { + @SuppressWarnings("unused") int foo = 1; + try { + for (int i = 0; i < 1024; i++) { + if (i % 2 == 0) { + ints[i] = doIt(i); + } + } + } catch (Exception e) { + // nothing + } + } +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/UsesThrowTest.java b/src/test/java/com/aparapi/codegen/test/UsesThrowTest.java new file mode 100644 index 00000000..282364c4 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/UsesThrowTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class UsesThrowTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void UsesThrowTest() { + test(com.aparapi.codegen.test.UsesThrow.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void UsesThrowTestWorksWithCaching() { + test(com.aparapi.codegen.test.UsesThrow.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/VarargsForEach.java b/src/test/java/com/aparapi/codegen/test/VarargsForEach.java new file mode 100644 index 00000000..d53d41a1 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/VarargsForEach.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class VarargsForEach { + int out[] = new int[1]; + + public static int max(int... values) { + if (values.length == 0) { + return 0; + } + + int max = Integer.MIN_VALUE; + for (int i : values) { + if (i > max) + max = i; + } + return max; + } + + public void run() { + out[0] = max(1, 4, 5, 9, 3); + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/VarargsForEachTest.java b/src/test/java/com/aparapi/codegen/test/VarargsForEachTest.java new file mode 100644 index 00000000..9fe2e763 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/VarargsForEachTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class VarargsForEachTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void VarargsForEachTest() { + test(com.aparapi.codegen.test.VarargsForEach.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void VarargsForEachTestWorksWithCaching() { + test(com.aparapi.codegen.test.VarargsForEach.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/VarargsSimple.java b/src/test/java/com/aparapi/codegen/test/VarargsSimple.java new file mode 100644 index 00000000..76a63091 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/VarargsSimple.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class VarargsSimple { + int out[] = new int[1]; + + public static int max(int... values) { + if (values.length == 0) { + return 0; + } + + int max = Integer.MIN_VALUE; + for (int i = 0; i < values.length; i++) { + if (values[i] > max) + max = i; + } + return max; + } + + public void run() { + out[0] = max(1, 4, 5, 9, 3); + } + +} +/**{Throws{ClassParseException}Throws}**/ diff --git a/src/test/java/com/aparapi/codegen/test/VarargsSimpleTest.java b/src/test/java/com/aparapi/codegen/test/VarargsSimpleTest.java new file mode 100644 index 00000000..b47f8026 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/VarargsSimpleTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class VarargsSimpleTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void VarargsSimpleTest() { + test(com.aparapi.codegen.test.VarargsSimple.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void VarargsSimpleTestWorksWithCaching() { + test(com.aparapi.codegen.test.VarargsSimple.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/While.java b/src/test/java/com/aparapi/codegen/test/While.java new file mode 100644 index 00000000..af1c299d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/While.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class While { + public void run() { + @SuppressWarnings("unused") boolean pass = false; + int i = 0; + while (i < 10) { + pass = true; + i++; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + char pass = 0; + int i = 0; + for (; i<10; i++){ + pass = 1; + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WhileAndMandel.java b/src/test/java/com/aparapi/codegen/test/WhileAndMandel.java new file mode 100644 index 00000000..373bf036 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileAndMandel.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WhileAndMandel { + int width = 1024; + + float scale = 1f; + + int maxIterations = 10; + + public void run() { + int tid = 0; + + int i = tid % width; + int j = tid / width; + + float x0 = ((i * scale) - ((scale / 2) * width)) / width; + float y0 = ((j * scale) - ((scale / 2) * width)) / width; + + float x = x0; + float y = y0; + + float x2 = x * x; + float y2 = y * y; + + float scaleSquare = scale * scale; + + int count = 0; + int iter = 0; + while ((x2 + y2 <= scaleSquare) && (iter < maxIterations)) { + + y = 2 * x * y + y0; + x = x2 - y2 + x0; + + x2 = x * x; + y2 = y * y; + count++; + ++iter; + } + @SuppressWarnings("unused") int value = (256 * count) / maxIterations; + } +} +/**{OpenCL{ + typedef struct This_s{ + int width; + float scale; + int maxIterations; + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int width, + float scale, + int maxIterations, + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->width = width; + this->scale = scale; + this->maxIterations = maxIterations; + this->passid = passid; + { + int tid = 0; + int i = tid % this->width; + int j = tid / this->width; + float x0 = (((float)i * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float y0 = (((float)j * this->scale) - ((this->scale / 2.0f) * (float)this->width)) / (float)this->width; + float x = x0; + float y = y0; + float x2 = x * x; + float y2 = y * y; + float scaleSquare = this->scale * this->scale; + int count = 0; + int iter = 0; + for (; (x2 + y2)<=scaleSquare && iter<this->maxIterations; iter++){ + y = ((2.0f * x) * y) + y0; + x = (x2 - y2) + x0; + x2 = x * x; + y2 = y * y; + count++; + } + int value = (256 * count) / this->maxIterations; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WhileAndMandelTest.java b/src/test/java/com/aparapi/codegen/test/WhileAndMandelTest.java new file mode 100644 index 00000000..08798b52 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileAndMandelTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileAndMandelTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileAndMandelTest() { + test(com.aparapi.codegen.test.WhileAndMandel.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileAndMandelTestWorksWithCaching() { + test(com.aparapi.codegen.test.WhileAndMandel.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WhileEmptyLoop.java b/src/test/java/com/aparapi/codegen/test/WhileEmptyLoop.java new file mode 100644 index 00000000..c39aefcb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileEmptyLoop.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WhileEmptyLoop { + public void run() { + int x = 10; + while (x-- != 0) { + } + } +} +/**{OpenCL{ + typedef struct This_s{ + + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + for (int x = 10; x--!=0;){} + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WhileEmptyLoopTest.java b/src/test/java/com/aparapi/codegen/test/WhileEmptyLoopTest.java new file mode 100644 index 00000000..0c843f11 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileEmptyLoopTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileEmptyLoopTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileEmptyLoopTest() { + test(com.aparapi.codegen.test.WhileEmptyLoop.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileEmptyLoopTestWorksWithCaching() { + test(com.aparapi.codegen.test.WhileEmptyLoop.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WhileFloatCompound.java b/src/test/java/com/aparapi/codegen/test/WhileFloatCompound.java new file mode 100644 index 00000000..9681ad89 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileFloatCompound.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WhileFloatCompound { + + public float randomFunc() { + + return (1.0f); + } + + public void run() { + float v1 = 1f, v2 = 0f, s = 1f; + + while (s < 1 && s > 0) { + v1 = randomFunc(); + v2 = randomFunc(); + s = v1 * v1 + v2 * v2; + } + + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + float com_amd_aparapi_test_WhileFloatCompound__randomFunc(This *this){ + return(1.0f); + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + float v1 = 1.0f; + float v2 = 0.0f; + float s = 1.0f; + for (; s<1.0f && s>0.0f; s = (v1 * v1) + (v2 * v2)){ + v1 = com_amd_aparapi_test_WhileFloatCompound__randomFunc(this); + v2 = com_amd_aparapi_test_WhileFloatCompound__randomFunc(this); + } + return; + } + } + }OpenCL}**/ + diff --git a/src/test/java/com/aparapi/codegen/test/WhileFloatCompoundTest.java b/src/test/java/com/aparapi/codegen/test/WhileFloatCompoundTest.java new file mode 100644 index 00000000..ae34cec8 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileFloatCompoundTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileFloatCompoundTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileFloatCompoundTest() { + test(com.aparapi.codegen.test.WhileFloatCompound.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileFloatCompoundTestWorksWithCaching() { + test(com.aparapi.codegen.test.WhileFloatCompound.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WhileIf.java b/src/test/java/com/aparapi/codegen/test/WhileIf.java new file mode 100644 index 00000000..6c3a175a --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileIf.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WhileIf { + public void run() { + + int a = 0; + int b = 0; + int c = 0; + int d = 0; + + while (a == a) { + if (b == b) { + c = c; + } + //d = d; // remove this will work + } + } + +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int a = 0; + int b = 0; + int c = 0; + int d = 0; + for (; a==a; ){ + if (b==b){ + c = c; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WhileIfElse.java b/src/test/java/com/aparapi/codegen/test/WhileIfElse.java new file mode 100644 index 00000000..806a855f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileIfElse.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WhileIfElse { + public void run() { + + int a = 0; + int b = 0; + int c = 0; + int d = 0; + + while (a == a) { + if (b == b) { + c = c; + } else { + d = d; + } + } + } + +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int a = 0; + int b = 0; + int c = 0; + int d = 0; + for (; a==a; ){ + if (b==b){ + c = c; + } else { + d = d; + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WhileIfElseTest.java b/src/test/java/com/aparapi/codegen/test/WhileIfElseTest.java new file mode 100644 index 00000000..d22bc72c --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileIfElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileIfElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileIfElseTest() { + test(com.aparapi.codegen.test.WhileIfElse.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileIfElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.WhileIfElse.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WhileIfTest.java b/src/test/java/com/aparapi/codegen/test/WhileIfTest.java new file mode 100644 index 00000000..e1d175b9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileIfTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileIfTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileIfTest() { + test(com.aparapi.codegen.test.WhileIf.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileIfTestWorksWithCaching() { + test(com.aparapi.codegen.test.WhileIf.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WhileTest.java b/src/test/java/com/aparapi/codegen/test/WhileTest.java new file mode 100644 index 00000000..71b25319 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileTest() { + test(com.aparapi.codegen.test.While.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileTestWorksWithCaching() { + test(com.aparapi.codegen.test.While.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WhileWithoutMutator.java b/src/test/java/com/aparapi/codegen/test/WhileWithoutMutator.java new file mode 100644 index 00000000..ecabbdfd --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileWithoutMutator.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WhileWithoutMutator { + public void run() { + int x = 0; + while (x != 0) { + } + } +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int x = 0; + for (; x!=0;){} + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WhileWithoutMutatorTest.java b/src/test/java/com/aparapi/codegen/test/WhileWithoutMutatorTest.java new file mode 100644 index 00000000..440435f2 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WhileWithoutMutatorTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WhileWithoutMutatorTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WhileWithoutMutatorTest() { + test(com.aparapi.codegen.test.WhileWithoutMutator.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WhileWithoutMutatorTestWorksWithCaching() { + test(com.aparapi.codegen.test.WhileWithoutMutator.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/While_If_IfElseElse.java b/src/test/java/com/aparapi/codegen/test/While_If_IfElseElse.java new file mode 100644 index 00000000..2b7f1eeb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/While_If_IfElseElse.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class While_If_IfElseElse { + public void run() { + + int a = 0; + int b = 0; + int c = 0; + int d = 0; + int e = 0; + int f = 0; + int g = 0; + int h = 0; + int i = 0; + int j = 0; + int k = 0; + int l = 0; + int m = 0; + int n = 0; + int o = 0; + int p = 0; + int q = 0; + int r = 0; + + while (a == a) { + b = b; + if (c == c) { + d = d; + if (e == e && f == f) { + g = g; + } + } + if (h == h && i == i) { + if (j == j) { + k = k; + + } + if (l == l) { + if (m == m) { + n = n; + } else if (o == o) { + p = p; + } else { + q = q; + } + r = r; + } + } + } + + } + +} +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int a = 0; + int b = 0; + int c = 0; + int d = 0; + int e = 0; + int f = 0; + int g = 0; + int h = 0; + int i = 0; + int j = 0; + int k = 0; + int l = 0; + int m = 0; + int n = 0; + int o = 0; + int p = 0; + int q = 0; + int r = 0; + for (; a==a; ){ + b = b; + if (c==c){ + d = d; + if (e==e && f==f){ + g = g; + } + } + + if (h==h && i==i){ + if (j==j){ + k = k; + } + if (l==l){ + if (m==m){ + n = n; + } else { + if (o==o){ + p = p; + } else { + q = q; + } + } + r = r; + } + } + } + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/While_If_IfElseElseTest.java b/src/test/java/com/aparapi/codegen/test/While_If_IfElseElseTest.java new file mode 100644 index 00000000..120cceea --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/While_If_IfElseElseTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class While_If_IfElseElseTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void While_If_IfElseElseTest() { + test(com.aparapi.codegen.test.While_If_IfElseElse.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void While_If_IfElseElseTestWorksWithCaching() { + test(com.aparapi.codegen.test.While_If_IfElseElse.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WideInc.java b/src/test/java/com/aparapi/codegen/test/WideInc.java new file mode 100644 index 00000000..e515d03f --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WideInc.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WideInc { + + public void run() { + int value = 0; + value += 128; + } +} + +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int value = 0; + value+=128; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WideIncTest.java b/src/test/java/com/aparapi/codegen/test/WideIncTest.java new file mode 100644 index 00000000..1bf3accb --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WideIncTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WideIncTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WideIncTest() { + test(com.aparapi.codegen.test.WideInc.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WideIncTestWorksWithCaching() { + test(com.aparapi.codegen.test.WideInc.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/codegen/test/WideLoad.java b/src/test/java/com/aparapi/codegen/test/WideLoad.java new file mode 100644 index 00000000..2c59483d --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WideLoad.java @@ -0,0 +1,558 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +public class WideLoad { + + public void run() { + // we need 256 local variables to force the use of wide local variable indices + int value00 = 0; + int value01 = 0; + int value02 = 0; + int value03 = 0; + int value04 = 0; + int value05 = 0; + int value06 = 0; + int value07 = 0; + int value08 = 0; + int value09 = 0; + int value0A = 0; + int value0B = 0; + int value0C = 0; + int value0D = 0; + int value0E = 0; + int value0F = 0; + int value10 = 0; + int value11 = 0; + int value12 = 0; + int value13 = 0; + int value14 = 0; + int value15 = 0; + int value16 = 0; + int value17 = 0; + int value18 = 0; + int value19 = 0; + int value1A = 0; + int value1B = 0; + int value1C = 0; + int value1D = 0; + int value1E = 0; + int value1F = 0; + int value20 = 0; + int value21 = 0; + int value22 = 0; + int value23 = 0; + int value24 = 0; + int value25 = 0; + int value26 = 0; + int value27 = 0; + int value28 = 0; + int value29 = 0; + int value2A = 0; + int value2B = 0; + int value2C = 0; + int value2D = 0; + int value2E = 0; + int value2F = 0; + int value30 = 0; + int value31 = 0; + int value32 = 0; + int value33 = 0; + int value34 = 0; + int value35 = 0; + int value36 = 0; + int value37 = 0; + int value38 = 0; + int value39 = 0; + int value3A = 0; + int value3B = 0; + int value3C = 0; + int value3D = 0; + int value3E = 0; + int value3F = 0; + int value40 = 0; + int value41 = 0; + int value42 = 0; + int value43 = 0; + int value44 = 0; + int value45 = 0; + int value46 = 0; + int value47 = 0; + int value48 = 0; + int value49 = 0; + int value4A = 0; + int value4B = 0; + int value4C = 0; + int value4D = 0; + int value4E = 0; + int value4F = 0; + int value50 = 0; + int value51 = 0; + int value52 = 0; + int value53 = 0; + int value54 = 0; + int value55 = 0; + int value56 = 0; + int value57 = 0; + int value58 = 0; + int value59 = 0; + int value5A = 0; + int value5B = 0; + int value5C = 0; + int value5D = 0; + int value5E = 0; + int value5F = 0; + int value60 = 0; + int value61 = 0; + int value62 = 0; + int value63 = 0; + int value64 = 0; + int value65 = 0; + int value66 = 0; + int value67 = 0; + int value68 = 0; + int value69 = 0; + int value6A = 0; + int value6B = 0; + int value6C = 0; + int value6D = 0; + int value6E = 0; + int value6F = 0; + int value70 = 0; + int value71 = 0; + int value72 = 0; + int value73 = 0; + int value74 = 0; + int value75 = 0; + int value76 = 0; + int value77 = 0; + int value78 = 0; + int value79 = 0; + int value7A = 0; + int value7B = 0; + int value7C = 0; + int value7D = 0; + int value7E = 0; + int value7F = 0; + int value80 = 0; + int value81 = 0; + int value82 = 0; + int value83 = 0; + int value84 = 0; + int value85 = 0; + int value86 = 0; + int value87 = 0; + int value88 = 0; + int value89 = 0; + int value8A = 0; + int value8B = 0; + int value8C = 0; + int value8D = 0; + int value8E = 0; + int value8F = 0; + int value90 = 0; + int value91 = 0; + int value92 = 0; + int value93 = 0; + int value94 = 0; + int value95 = 0; + int value96 = 0; + int value97 = 0; + int value98 = 0; + int value99 = 0; + int value9A = 0; + int value9B = 0; + int value9C = 0; + int value9D = 0; + int value9E = 0; + int value9F = 0; + int valueA0 = 0; + int valueA1 = 0; + int valueA2 = 0; + int valueA3 = 0; + int valueA4 = 0; + int valueA5 = 0; + int valueA6 = 0; + int valueA7 = 0; + int valueA8 = 0; + int valueA9 = 0; + int valueAA = 0; + int valueAB = 0; + int valueAC = 0; + int valueAD = 0; + int valueAE = 0; + int valueAF = 0; + int valueB0 = 0; + int valueB1 = 0; + int valueB2 = 0; + int valueB3 = 0; + int valueB4 = 0; + int valueB5 = 0; + int valueB6 = 0; + int valueB7 = 0; + int valueB8 = 0; + int valueB9 = 0; + int valueBA = 0; + int valueBB = 0; + int valueBC = 0; + int valueBD = 0; + int valueBE = 0; + int valueBF = 0; + int valueC0 = 0; + int valueC1 = 0; + int valueC2 = 0; + int valueC3 = 0; + int valueC4 = 0; + int valueC5 = 0; + int valueC6 = 0; + int valueC7 = 0; + int valueC8 = 0; + int valueC9 = 0; + int valueCA = 0; + int valueCB = 0; + int valueCC = 0; + int valueCD = 0; + int valueCE = 0; + int valueCF = 0; + int valueD0 = 0; + int valueD1 = 0; + int valueD2 = 0; + int valueD3 = 0; + int valueD4 = 0; + int valueD5 = 0; + int valueD6 = 0; + int valueD7 = 0; + int valueD8 = 0; + int valueD9 = 0; + int valueDA = 0; + int valueDB = 0; + int valueDC = 0; + int valueDD = 0; + int valueDE = 0; + int valueDF = 0; + int valueE0 = 0; + int valueE1 = 0; + int valueE2 = 0; + int valueE3 = 0; + int valueE4 = 0; + int valueE5 = 0; + int valueE6 = 0; + int valueE7 = 0; + int valueE8 = 0; + int valueE9 = 0; + int valueEA = 0; + int valueEB = 0; + int valueEC = 0; + int valueED = 0; + int valueEE = 0; + int valueEF = 0; + int valueF0 = 0; + int valueF1 = 0; + int valueF2 = 0; + int valueF3 = 0; + int valueF4 = 0; + int valueF5 = 0; + int valueF6 = 0; + int valueF7 = 0; + int valueF8 = 0; + int valueF9 = 0; + int valueFA = 0; + int valueFB = 0; + int valueFC = 0; + int valueFD = 0; + int valueFE = 0; + int valueFF = 0; + int valueWide = 0; // wide + valueWide++; // wide + } +} + +/**{OpenCL{ + typedef struct This_s{ + int passid; + }This; + int get_pass_id(This *this){ + return this->passid; + } + __kernel void run( + int passid + ){ + This thisStruct; + This* this=&thisStruct; + this->passid = passid; + { + int value00 = 0; + int value01 = 0; + int value02 = 0; + int value03 = 0; + int value04 = 0; + int value05 = 0; + int value06 = 0; + int value07 = 0; + int value08 = 0; + int value09 = 0; + int value0A = 0; + int value0B = 0; + int value0C = 0; + int value0D = 0; + int value0E = 0; + int value0F = 0; + int value10 = 0; + int value11 = 0; + int value12 = 0; + int value13 = 0; + int value14 = 0; + int value15 = 0; + int value16 = 0; + int value17 = 0; + int value18 = 0; + int value19 = 0; + int value1A = 0; + int value1B = 0; + int value1C = 0; + int value1D = 0; + int value1E = 0; + int value1F = 0; + int value20 = 0; + int value21 = 0; + int value22 = 0; + int value23 = 0; + int value24 = 0; + int value25 = 0; + int value26 = 0; + int value27 = 0; + int value28 = 0; + int value29 = 0; + int value2A = 0; + int value2B = 0; + int value2C = 0; + int value2D = 0; + int value2E = 0; + int value2F = 0; + int value30 = 0; + int value31 = 0; + int value32 = 0; + int value33 = 0; + int value34 = 0; + int value35 = 0; + int value36 = 0; + int value37 = 0; + int value38 = 0; + int value39 = 0; + int value3A = 0; + int value3B = 0; + int value3C = 0; + int value3D = 0; + int value3E = 0; + int value3F = 0; + int value40 = 0; + int value41 = 0; + int value42 = 0; + int value43 = 0; + int value44 = 0; + int value45 = 0; + int value46 = 0; + int value47 = 0; + int value48 = 0; + int value49 = 0; + int value4A = 0; + int value4B = 0; + int value4C = 0; + int value4D = 0; + int value4E = 0; + int value4F = 0; + int value50 = 0; + int value51 = 0; + int value52 = 0; + int value53 = 0; + int value54 = 0; + int value55 = 0; + int value56 = 0; + int value57 = 0; + int value58 = 0; + int value59 = 0; + int value5A = 0; + int value5B = 0; + int value5C = 0; + int value5D = 0; + int value5E = 0; + int value5F = 0; + int value60 = 0; + int value61 = 0; + int value62 = 0; + int value63 = 0; + int value64 = 0; + int value65 = 0; + int value66 = 0; + int value67 = 0; + int value68 = 0; + int value69 = 0; + int value6A = 0; + int value6B = 0; + int value6C = 0; + int value6D = 0; + int value6E = 0; + int value6F = 0; + int value70 = 0; + int value71 = 0; + int value72 = 0; + int value73 = 0; + int value74 = 0; + int value75 = 0; + int value76 = 0; + int value77 = 0; + int value78 = 0; + int value79 = 0; + int value7A = 0; + int value7B = 0; + int value7C = 0; + int value7D = 0; + int value7E = 0; + int value7F = 0; + int value80 = 0; + int value81 = 0; + int value82 = 0; + int value83 = 0; + int value84 = 0; + int value85 = 0; + int value86 = 0; + int value87 = 0; + int value88 = 0; + int value89 = 0; + int value8A = 0; + int value8B = 0; + int value8C = 0; + int value8D = 0; + int value8E = 0; + int value8F = 0; + int value90 = 0; + int value91 = 0; + int value92 = 0; + int value93 = 0; + int value94 = 0; + int value95 = 0; + int value96 = 0; + int value97 = 0; + int value98 = 0; + int value99 = 0; + int value9A = 0; + int value9B = 0; + int value9C = 0; + int value9D = 0; + int value9E = 0; + int value9F = 0; + int valueA0 = 0; + int valueA1 = 0; + int valueA2 = 0; + int valueA3 = 0; + int valueA4 = 0; + int valueA5 = 0; + int valueA6 = 0; + int valueA7 = 0; + int valueA8 = 0; + int valueA9 = 0; + int valueAA = 0; + int valueAB = 0; + int valueAC = 0; + int valueAD = 0; + int valueAE = 0; + int valueAF = 0; + int valueB0 = 0; + int valueB1 = 0; + int valueB2 = 0; + int valueB3 = 0; + int valueB4 = 0; + int valueB5 = 0; + int valueB6 = 0; + int valueB7 = 0; + int valueB8 = 0; + int valueB9 = 0; + int valueBA = 0; + int valueBB = 0; + int valueBC = 0; + int valueBD = 0; + int valueBE = 0; + int valueBF = 0; + int valueC0 = 0; + int valueC1 = 0; + int valueC2 = 0; + int valueC3 = 0; + int valueC4 = 0; + int valueC5 = 0; + int valueC6 = 0; + int valueC7 = 0; + int valueC8 = 0; + int valueC9 = 0; + int valueCA = 0; + int valueCB = 0; + int valueCC = 0; + int valueCD = 0; + int valueCE = 0; + int valueCF = 0; + int valueD0 = 0; + int valueD1 = 0; + int valueD2 = 0; + int valueD3 = 0; + int valueD4 = 0; + int valueD5 = 0; + int valueD6 = 0; + int valueD7 = 0; + int valueD8 = 0; + int valueD9 = 0; + int valueDA = 0; + int valueDB = 0; + int valueDC = 0; + int valueDD = 0; + int valueDE = 0; + int valueDF = 0; + int valueE0 = 0; + int valueE1 = 0; + int valueE2 = 0; + int valueE3 = 0; + int valueE4 = 0; + int valueE5 = 0; + int valueE6 = 0; + int valueE7 = 0; + int valueE8 = 0; + int valueE9 = 0; + int valueEA = 0; + int valueEB = 0; + int valueEC = 0; + int valueED = 0; + int valueEE = 0; + int valueEF = 0; + int valueF0 = 0; + int valueF1 = 0; + int valueF2 = 0; + int valueF3 = 0; + int valueF4 = 0; + int valueF5 = 0; + int valueF6 = 0; + int valueF7 = 0; + int valueF8 = 0; + int valueF9 = 0; + int valueFA = 0; + int valueFB = 0; + int valueFC = 0; + int valueFD = 0; + int valueFE = 0; + int valueFF = 0; + int valueWide = 0; + valueWide++; + return; + } + } + }OpenCL}**/ diff --git a/src/test/java/com/aparapi/codegen/test/WideLoadTest.java b/src/test/java/com/aparapi/codegen/test/WideLoadTest.java new file mode 100644 index 00000000..40f801b9 --- /dev/null +++ b/src/test/java/com/aparapi/codegen/test/WideLoadTest.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2016 - 2017 Syncleus, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.aparapi.codegen.test; + +import org.junit.Test; + +public class WideLoadTest extends com.aparapi.codegen.CodeGenJUnitBase { + private static final String[] expectedOpenCL = null; + private static final Class<? extends com.aparapi.internal.exception.AparapiException> expectedException = null; + + @org.junit.Ignore + @Test + public void WideLoadTest() { + test(com.aparapi.codegen.test.WideLoad.class, expectedException, expectedOpenCL); + } + + @org.junit.Ignore + @Test + public void WideLoadTestWorksWithCaching() { + test(com.aparapi.codegen.test.WideLoad.class, expectedException, expectedOpenCL); + } +} diff --git a/src/test/java/com/aparapi/runtime/LoadClTest.java b/src/test/java/com/aparapi/runtime/LoadClTest.java index 60adc755..5df9c668 100644 --- a/src/test/java/com/aparapi/runtime/LoadClTest.java +++ b/src/test/java/com/aparapi/runtime/LoadClTest.java @@ -62,7 +62,7 @@ public class LoadClTest { } } - @Resource("com/aparapi/test/runtime/squarer.cl") + @Resource("com/aparapi/codegen/test/runtime/squarer.cl") interface Squarer extends OpenCL<Squarer> { public Squarer square(// Range _range,// -- GitLab