annotate graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/FloatPTXTest.java @ 15494:e20a45d17181

Move CIPrintCompilerName handling into CompileTask::print_compilation_impl
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 30 Apr 2014 11:48:13 +0200
parents 878f0a2a062b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
1 /*
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
4 *
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
8 *
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
13 * accompanied this code).
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
14 *
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
18 *
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
21 * questions.
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
22 */
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.compiler.ptx.test;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
24
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
25 import org.junit.*;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
26
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
27 /* PTX ISA 3.1 - 8.7.3 Floating-Point Instructions */
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
28 public class FloatPTXTest extends PTXTest {
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
29
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
30 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
31 public void testAdd() {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
32 test("testAdd2I", 42, 43);
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
33 test("testAdd2F", 42.1F, 43.5F);
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
34 test("testAddFConst", 42.1F);
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
35 test("testAdd2D", 42.1, 43.5);
11902
67a1e27a8dbb PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents: 11896
diff changeset
36 }
67a1e27a8dbb PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents: 11896
diff changeset
37
67a1e27a8dbb PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents: 11896
diff changeset
38 public static float testAdd2I(int a, int b) {
11937
12e119095ac8 Fix warnings in PTX code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11902
diff changeset
39 return a + b;
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
40 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
41
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
42 public static float testAdd2F(float a, float b) {
11902
67a1e27a8dbb PTX initial float and double
Morris Meyer <morris.meyer@oracle.com>
parents: 11896
diff changeset
43 return (a + b);
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
44 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
45
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
46 public static double testAdd2D(double a, double b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
47 return a + b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
48 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
49
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
50 public static float testAddFConst(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
51 return a + 32.0F;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
52 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
53
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
54 public static float testAddConstF(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
55 return 32.0F + a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
56 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
57
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
58 public static double testAddDConst(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
59 return a + 32.0;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
60 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
61
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
62 public static double testAddConstD(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
63 return 32.0 + a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
64 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
65
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
66 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
67 public void testSub() {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
68 compileKernel("testSub2F");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
69 compileKernel("testSub2D");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
70 compileKernel("testSubFConst");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
71 compileKernel("testSubConstF");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
72 compileKernel("testSubDConst");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
73 compileKernel("testSubConstD");
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
74 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
75
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
76 public static float testSub2F(float a, float b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
77 return a - b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
78 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
79
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
80 public static double testSub2D(double a, double b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
81 return a - b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
82 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
83
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
84 public static float testSubFConst(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
85 return a - 32.0F;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
86 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
87
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
88 public static float testSubConstF(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
89 return 32.0F - a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
90 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
91
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
92 public static double testSubDConst(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
93 return a - 32.0;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
94 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
95
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
96 public static double testSubConstD(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
97 return 32.0 - a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
98 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
99
13755
878f0a2a062b enabled some tests in FloatPTXTest that now work
Doug Simon <doug.simon@oracle.com>
parents: 13650
diff changeset
100 @Ignore("[CUDA] *** Error (209) Failed to load module data with online compiler options for method testMul2F")
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
101 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
102 public void testMul() {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
103 compileKernel("testMul2F");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
104 compileKernel("testMul2D");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
105 compileKernel("testMulFConst");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
106 compileKernel("testMulConstF");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
107 compileKernel("testMulDConst");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
108 compileKernel("testMulConstD");
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
109 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
110
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
111 public static float testMul2F(float a, float b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
112 return a * b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
113 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
114
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
115 public static double testMul2D(double a, double b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
116 return a * b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
117 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
118
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
119 public static float testMulFConst(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
120 return a * 32.0F;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
121 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
122
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
123 public static float testMulConstF(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
124 return 32.0F * a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
125 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
126
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
127 public static double testMulDConst(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
128 return a * 32.0;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
129 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
130
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
131 public static double testMulConstD(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
132 return 32.0 * a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
133 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
134
13755
878f0a2a062b enabled some tests in FloatPTXTest that now work
Doug Simon <doug.simon@oracle.com>
parents: 13650
diff changeset
135 @Ignore("[CUDA] *** Error (209) Failed to load module data with online compiler options for method testDiv2F")
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
136 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
137 public void testDiv() {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
138 compileKernel("testDiv2F");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
139 compileKernel("testDiv2D");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
140 compileKernel("testDivFConst");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
141 compileKernel("testDivConstF");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
142 compileKernel("testDivDConst");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
143 compileKernel("testDivConstD");
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
144 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
145
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
146 public static float testDiv2F(float a, float b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
147 return a / b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
148 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
149
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
150 public static double testDiv2D(double a, double b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
151 return a / b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
152 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
153
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
154 public static float testDivFConst(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
155 return a / 32.0F;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
156 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
157
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
158 public static float testDivConstF(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
159 return 32.0F / a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
160 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
161
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
162 public static double testDivDConst(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
163 return a / 32.0;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
164 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
165
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
166 public static double testDivConstD(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
167 return 32.0 / a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
168 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
169
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
170 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
171 public void testNeg() {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
172 compileKernel("testNeg2F");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
173 compileKernel("testNeg2D");
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
174 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
175
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
176 public static float testNeg2F(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
177 return -a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
178 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
179
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
180 public static double testNeg2D(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
181 return -a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
182 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
183
13755
878f0a2a062b enabled some tests in FloatPTXTest that now work
Doug Simon <doug.simon@oracle.com>
parents: 13650
diff changeset
184 @Ignore("need linkage to PTX remainder")
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
185 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
186 public void testRem() {
13755
878f0a2a062b enabled some tests in FloatPTXTest that now work
Doug Simon <doug.simon@oracle.com>
parents: 13650
diff changeset
187 compileKernel("testRem2F");
878f0a2a062b enabled some tests in FloatPTXTest that now work
Doug Simon <doug.simon@oracle.com>
parents: 13650
diff changeset
188 compileKernel("testRem2D");
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
189 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
190
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
191 public static float testRem2F(float a, float b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
192 return a % b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
193 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
194
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
195 public static double testRem2D(double a, double b) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
196 return a % b;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
197 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
198
13755
878f0a2a062b enabled some tests in FloatPTXTest that now work
Doug Simon <doug.simon@oracle.com>
parents: 13650
diff changeset
199 @Ignore("[CUDA] *** Error (209) Failed to load module data with online compiler options for method testF2I")
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
200 @Test
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
201 public void testFloatConversion() {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
202 compileKernel("testF2I");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
203 compileKernel("testF2L");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
204 compileKernel("testF2D");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
205 compileKernel("testD2I");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
206 compileKernel("testD2L");
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
207 compileKernel("testD2F");
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
208 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
209
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
210 public static int testF2I(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
211 return (int) a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
212 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
213
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
214 public static long testF2L(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
215 return (long) a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
216 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
217
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
218 public static double testF2D(float a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
219 return a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
220 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
221
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
222 public static int testD2I(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
223 return (int) a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
224 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
225
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
226 public static long testD2L(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
227 return (long) a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
228 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
229
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
230 public static float testD2F(double a) {
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
231 return (float) a;
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
232 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
233
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
234 public static void main(String[] args) {
13650
1095dcf7f028 reworked PTX unit tests to PTX kernel call wrapper
Doug Simon <doug.simon@oracle.com>
parents: 13185
diff changeset
235 compileAndPrintCode(new FloatPTXTest());
8995
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
236 }
585cc62fcdc5 PTX enhancements - arithmetic, control, float, integer math, control and basic switch
Morris Meyer <morris.meyer@oracle.com>
parents:
diff changeset
237 }