Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java @ 6496:16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 03 Oct 2012 16:49:51 +0200 |
parents | graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java@85c1b84f8fd9 |
children | 4afe23aa0a00 |
comparison
equal
deleted
inserted
replaced
6495:75f130f2b30f | 6496:16d1411409b4 |
---|---|
1 /* | |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.lir.amd64; | |
24 | |
25 import static com.oracle.graal.api.code.ValueUtil.*; | |
26 | |
27 import com.oracle.graal.api.meta.*; | |
28 import com.oracle.graal.graph.*; | |
29 import com.oracle.graal.lir.asm.*; | |
30 import com.oracle.max.asm.amd64.*; | |
31 | |
32 public class AMD64MathIntrinsicOp extends AMD64LIRInstruction { | |
33 public enum IntrinsicOpcode { | |
34 SQRT, | |
35 SIN, COS, TAN, | |
36 LOG, LOG10; | |
37 } | |
38 | |
39 @Opcode private final IntrinsicOpcode opcode; | |
40 @Def protected Value result; | |
41 @Use protected Value input; | |
42 | |
43 public AMD64MathIntrinsicOp(IntrinsicOpcode opcode, Value result, Value input) { | |
44 this.opcode = opcode; | |
45 this.result = result; | |
46 this.input = input; | |
47 } | |
48 | |
49 @Override | |
50 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { | |
51 switch (opcode) { | |
52 case SQRT: masm.sqrtsd(asDoubleReg(result), asDoubleReg(input)); break; | |
53 case LOG: masm.flog(asDoubleReg(result), asDoubleReg(input), false); break; | |
54 case LOG10: masm.flog(asDoubleReg(result), asDoubleReg(input), true); break; | |
55 case SIN: masm.fsin(asDoubleReg(result), asDoubleReg(input)); break; | |
56 case COS: masm.fcos(asDoubleReg(result), asDoubleReg(input)); break; | |
57 case TAN: masm.ftan(asDoubleReg(result), asDoubleReg(input)); break; | |
58 default: throw GraalInternalError.shouldNotReachHere(); | |
59 } | |
60 } | |
61 } |