annotate graal/com.oracle.graal.lir.hsail/src/com/oracle/graal/lir/hsail/HSAILArithmetic.java @ 14044:0b3960586b48

IGV: fix NPE
author Andreas Woess <andreas.woess@jku.at>
date Mon, 03 Mar 2014 12:04:16 +0100
parents 958c99d0790c
children 64dcb92ee75a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.lir.hsail;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import static com.oracle.graal.api.code.ValueUtil.*;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.meta.*;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29 import com.oracle.graal.asm.hsail.*;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 import com.oracle.graal.graph.*;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.lir.*;
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
32 import com.oracle.graal.lir.asm.CompilationResultBuilder;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 /**
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 * Defines arithmetic instruction nodes.
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 */
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 public enum HSAILArithmetic {
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
38 ABS,
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
39 CALL,
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
40 CEIL,
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
41 FDIV,
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
42 FLOOR,
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
43 FREM,
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
44 DADD,
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
45 DDIV,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
46 DMUL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
47 DNEG,
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
48 DREM,
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
49 DSUB,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
50 FADD,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
51 FMUL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
52 FNEG,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
53 FSUB,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
54 IADD,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
55 IAND,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
56 ICARRY,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
57 IDIV,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
58 IMAX,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
59 IMIN,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
60 IMUL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
61 INEG,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
62 INOT,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
63 IOR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
64 IREM,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
65 ISHL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
66 ISHR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
67 ISUB,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
68 IUADD,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
69 IUCARRY,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
70 IUDIV,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
71 IUMAX,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
72 IUMIN,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
73 IUMUL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
74 IUREM,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
75 IUSHR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
76 IUSUB,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
77 IXOR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
78 LADD,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
79 LAND,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
80 LCARRY,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
81 LDIV,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
82 LMAX,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
83 LMIN,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
84 LMUL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
85 LNEG,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
86 LNOT,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
87 LOR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
88 LREM,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
89 LSHL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
90 LSHR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
91 LSUB,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
92 LUADD,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
93 LUCARRY,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
94 LUDIV,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
95 LUMAX,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
96 LUMIN,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
97 LUMUL,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
98 LUREM,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
99 LUSHR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
100 LUSUB,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
101 LXOR,
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
102 OADD,
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
103 RINT,
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
104 SQRT,
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
105 UNDEF;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
106
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
107 public static class ConvertOp extends HSAILLIRInstruction {
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13308
diff changeset
108 private final String from;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13308
diff changeset
109 private final String to;
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
110 @Def({REG}) protected AllocatableValue result;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
111 @Use({REG, STACK}) protected AllocatableValue x;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
112
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13308
diff changeset
113 public ConvertOp(AllocatableValue result, AllocatableValue x, String to, String from) {
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
114 this.from = from;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
115 this.to = to;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
116 this.result = result;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
117 this.x = x;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
118 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
119
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
120 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
121 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
122 masm.emitConvert(result, x, to, from);
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
123 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
124 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12651
diff changeset
125
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
126 public static class Op1Stack extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
127 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
128 @Def({REG, HINT}) protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
129 @Use({REG, STACK, CONST}) protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
130
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
131 public Op1Stack(HSAILArithmetic opcode, Value result, Value x) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
133 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
137 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
138 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
139 emit(crb, masm, opcode, result, x, null);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
140 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
141 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
142
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
143 public static class Op2Stack extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
145 @Def({REG, HINT}) protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 @Use({REG, CONST}) protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 @Alive({REG, CONST}) protected Value y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
148
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 public Op2Stack(HSAILArithmetic opcode, Value result, Value x, Value y) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
151 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
152 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153 this.y = y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
154 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
155
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
156 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
157 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
158 emit(crb, masm, opcode, result, x, y, null);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
159 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
160
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
161 @Override
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
162 public void verify() {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
163 super.verify();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
164 verifyKind(opcode, result, x, y);
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
165 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
166 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
167
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
168 public static class Op1Reg extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
169 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
170 @Def({REG, HINT}) protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
171 @Use({REG}) protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
172
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
173 public Op1Reg(HSAILArithmetic opcode, Value result, Value x) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
174 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
175 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
176 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
177 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
178
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
179 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
180 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
181 emit(crb, masm, opcode, result, x, null);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
182 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
183 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
184
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
185 public static class Op2Reg extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
186 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
187 @Def({REG, HINT}) protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
188 @Use({REG, STACK, CONST}) protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
189 @Alive({REG, CONST}) protected Value y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
190
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
191 public Op2Reg(HSAILArithmetic opcode, Value result, Value x, Value y) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
192 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
193 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
194 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
195 this.y = y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
196 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
197
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
198 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
199 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
200 emit(crb, masm, opcode, result, x, y, null);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
201 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
202
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
203 @Override
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
204 public void verify() {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
205 super.verify();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
206 verifyKind(opcode, result, x, y);
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
207 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
208 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
209
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
210 public static class Op2RegCommutative extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
211 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
212 @Def({REG, HINT}) protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
213 @Use({REG, STACK, CONST}) protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
214 @Use({REG, CONST}) protected Value y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
215
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
216 public Op2RegCommutative(HSAILArithmetic opcode, Value result, Value x, Value y) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
217 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
218 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
219 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
220 this.y = y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
221 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
222
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
223 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
224 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
225 throw GraalInternalError.shouldNotReachHere();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
226 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
227
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
228 @Override
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
229 protected void verify() {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
230 super.verify();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
231 verifyKind(opcode, result, x, y);
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
232 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
233 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
234
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
235 public static class ShiftOp extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
236 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
237 @Def({REG, HINT}) protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
238 @Use({REG, STACK, CONST}) protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
239 @Alive({REG, CONST}) protected Value y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
240
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
241 public ShiftOp(HSAILArithmetic opcode, Value result, Value x, Value y) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
242 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
243 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
244 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
245 this.y = y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
246 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
247
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
248 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
249 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
250 emit(crb, masm, opcode, result, x, y, null);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
251 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
252
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
253 @Override
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
254 public void verify() {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
255 super.verify();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
256 verifyKind(opcode, result, x, x);
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
257 assert y.getKind().getStackKind() == Kind.Int;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
258 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
259 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
260
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
261 public static class DivOp extends HSAILLIRInstruction {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
262 @Opcode private final HSAILArithmetic opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
263 @Def protected Value result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
264 @Use protected Value x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
265 @Alive protected Value y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
266 @State protected LIRFrameState state;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
267
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
268 public DivOp(HSAILArithmetic opcode, Value result, Value x, Value y, LIRFrameState state) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
269 this.opcode = opcode;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
270 this.result = result;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
271 this.x = x;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
272 this.y = y;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
273 this.state = state;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
274 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
275
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
276 @Override
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
277 public void emitCode(CompilationResultBuilder crb, HSAILAssembler masm) {
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
278 emit(crb, masm, opcode, result, y, state);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
279 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
280
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
281 @Override
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
282 protected void verify() {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
283 super.verify();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
284 verifyKind(opcode, result, x, y);
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
285 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
286 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
287
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
288 @SuppressWarnings("unused")
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
289 protected static void emit(CompilationResultBuilder crb, HSAILAssembler masm, HSAILArithmetic opcode, Value result) {
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
290 switch (opcode) {
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
291 default:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
292 throw GraalInternalError.shouldNotReachHere();
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
293 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
294 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
295
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
296 /**
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
297 * Emits the HSAIL code for an arithmetic operation taking one input parameter.
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
298 *
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
299 * @param crb the CompilationResultBuilder
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
300 * @param masm the HSAIL assembler
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
301 * @param opcode the opcode of the arithmetic operation
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
302 * @param dst the destination
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
303 * @param src the source parameter
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
304 * @param info structure that stores the LIRFrameState. Used for exception handling.
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
305 */
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
306
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
307 public static void emit(CompilationResultBuilder crb, HSAILAssembler masm, HSAILArithmetic opcode, Value dst, Value src, LIRFrameState info) {
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
308 int exceptionOffset = -1;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
309 if (isRegister(src)) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
310 switch (opcode) {
13308
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
311 case ABS:
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
312 masm.emit("abs", dst, src);
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
313 break;
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
314 case CEIL:
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
315 masm.emit("ceil", dst, src);
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
316 break;
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
317 case FLOOR:
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
318 masm.emit("floor", dst, src);
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
319 break;
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
320 case RINT:
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
321 masm.emit("rint", dst, src);
d3b3c6e17d40 HSAIL: added Math intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 13227
diff changeset
322 break;
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
323 case SQRT:
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
324 masm.emit("sqrt", dst, src);
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
325 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
326 case UNDEF:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
327 masm.undefined("undefined node");
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
328 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
329 case CALL:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
330 masm.undefined("undefined node CALL");
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
331 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
332 case INOT:
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
333 case LNOT:
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
334 masm.emitForceBitwise("not", dst, src);
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
335 break;
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
336 case INEG:
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
337 case LNEG:
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
338 case FNEG:
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
339 case DNEG:
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
340 masm.emit("neg", dst, src);
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
341 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
342 default:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
343 throw GraalInternalError.shouldNotReachHere();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
344 }
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
345 } else {
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
346 throw GraalInternalError.shouldNotReachHere();
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
347 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
348 if (info != null) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
349 assert exceptionOffset != -1;
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
350 crb.recordImplicitException(exceptionOffset, info);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
351 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
352 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
353
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
354 public static void emit(CompilationResultBuilder crb, HSAILAssembler masm, HSAILArithmetic opcode, Value dst, Value src1, Value src2, LIRFrameState info) {
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
355 /**
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
356 * First check if one of src1 or src2 is an AddressValue. If it is, convert the address to a
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
357 * register using an lda instruction. We can just reuse the eventual dst register for this.
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
358 */
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
359 if (src1 instanceof HSAILAddressValue) {
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
360 assert (!(src2 instanceof HSAILAddressValue));
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
361 masm.emitLda(dst, ((HSAILAddressValue) src1).toAddress());
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
362 emit(crb, masm, opcode, dst, dst, src2, info);
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
363 return;
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
364 } else if (src2 instanceof HSAILAddressValue) {
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
365 assert (!(src1 instanceof HSAILAddressValue));
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
366 masm.emitLda(dst, ((HSAILAddressValue) src2).toAddress());
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
367 emit(crb, masm, opcode, dst, src1, dst, info);
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
368 return;
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
369 }
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
370 int exceptionOffset = -1;
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
371 switch (opcode) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
372 case IADD:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
373 case LADD:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
374 case DADD:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
375 case FADD:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
376 case OADD:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
377 masm.emit("add", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
378 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
379 case ISUB:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
380 case LSUB:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
381 case DSUB:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
382 case FSUB:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
383 masm.emit("sub", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
384 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
385 case IMUL:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
386 case LMUL:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
387 case FMUL:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
388 case DMUL:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
389 case LUMUL:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
390 masm.emit("mul", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
391 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
392 case IDIV:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
393 case LDIV:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
394 case FDIV:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
395 case DDIV:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
396 masm.emit("div", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
397 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
398 case IMAX:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
399 case LMAX:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
400 masm.emit("max", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
401 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
402 case IMIN:
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
403 case LMIN:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
404 masm.emit("min", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
405 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
406 case ISHL:
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
407 case LSHL:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
408 masm.emit("shl", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
409 break;
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
410 case ISHR:
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
411 case LSHR:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
412 masm.emit("shr", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
413 break;
10769
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
414 case IUSHR:
395d34c10e26 HSAIL backend changes
Doug Simon <doug.simon@oracle.com>
parents: 10662
diff changeset
415 case LUSHR:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
416 masm.emitForceUnsigned("shr", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
417 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
418 case IAND:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
419 case LAND:
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
420 masm.emitForceBitwise("and", dst, src1, src2);
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
421 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
422 case IXOR:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
423 case LXOR:
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
424 masm.emitForceBitwise("xor", dst, src1, src2);
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
425 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
426 case IOR:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
427 case LOR:
12651
c73b857b1be9 Adds support to the HSAIL backend to generate code for bitwise right shift (>>), bitwise NOT (~), and arithmetic negation
Doug Simon <doug.simon@oracle.com>
parents: 12582
diff changeset
428 masm.emitForceBitwise("or", dst, src1, src2);
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
429 break;
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
430 case IREM:
13110
b96536453a74 HSAIL: added support for LREM
Doug Simon <doug.simon@oracle.com>
parents: 12656
diff changeset
431 case LREM:
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
432 masm.emit("rem", dst, src1, src2);
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
433 break;
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
434 default:
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
435 throw GraalInternalError.shouldNotReachHere();
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
436 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
437 if (info != null) {
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
438 assert exceptionOffset != -1;
13227
1a66453f73db renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents: 13110
diff changeset
439 crb.recordImplicitException(exceptionOffset, info);
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
440 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
441 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
442
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
443 private static void verifyKind(HSAILArithmetic opcode, Value result, Value x, Value y) {
12582
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
444 assert (opcode.name().startsWith("I") && result.getKind() == Kind.Int && x.getKind().getStackKind() == Kind.Int && y.getKind().getStackKind() == Kind.Int) ||
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
445 (opcode.name().startsWith("L") && result.getKind() == Kind.Long && x.getKind() == Kind.Long && y.getKind() == Kind.Long) ||
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
446 (opcode.name().startsWith("LU") && result.getKind() == Kind.Long && x.getKind() == Kind.Long && y.getKind() == Kind.Int) ||
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
447 (opcode.name().startsWith("F") && result.getKind() == Kind.Float && x.getKind() == Kind.Float && y.getKind() == Kind.Float) ||
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
448 (opcode.name().startsWith("D") && result.getKind() == Kind.Double && x.getKind() == Kind.Double && y.getKind() == Kind.Double) ||
a5a4a0bcd863 Adds support to the HSAIL backend for three of the bitwise logical operators, bitwise AND, bitwise OR and bitwise XOR.
twisti
parents: 11355
diff changeset
449 (opcode.name().startsWith("O") && result.getKind() == Kind.Object && x.getKind() == Kind.Object && (y.getKind() == Kind.Int || y.getKind() == Kind.Long));
10662
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
450 }
4ef92b67aeae added HSAIL backend and tests
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
451 }