Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java @ 21708:6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 03 Jun 2015 18:06:44 +0200 |
parents | 5024c80224c7 |
children | d915361cc3a1 |
rev | line source |
---|---|
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
15298
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
4 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
8 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
14 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
18 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
22 */ |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.lir.sparc; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
24 |
21708
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
25 import com.oracle.jvmci.asm.sparc.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
26 import com.oracle.jvmci.code.Register; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
27 import com.oracle.jvmci.meta.LIRKind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
28 import com.oracle.jvmci.meta.Kind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
29 import com.oracle.jvmci.meta.Value; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
30 import com.oracle.jvmci.meta.AllocatableValue; |
21673
5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
31 |
21708
6df25b1418be
moved com.oracle.asm.** to jvmci-util.jar (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21673
diff
changeset
|
32 import static com.oracle.jvmci.asm.sparc.SPARCAssembler.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
33 import static com.oracle.jvmci.code.ValueUtil.*; |
21673
5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21556
diff
changeset
|
34 import static com.oracle.jvmci.sparc.SPARC.*; |
11233 | 35 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
36 |
9856
fbeda9df497d
implemented workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=409824
Doug Simon <doug.simon@oracle.com>
parents:
9846
diff
changeset
|
37 import com.oracle.graal.lir.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.graal.lir.asm.*; |
15298
e4d6c613d552
Move LIRGeneratorTool to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
39 import com.oracle.graal.lir.gen.*; |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19678
diff
changeset
|
40 import com.oracle.jvmci.common.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
41 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16938
diff
changeset
|
42 public final class SPARCBitManipulationOp extends SPARCLIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16938
diff
changeset
|
43 public static final LIRInstructionClass<SPARCBitManipulationOp> TYPE = LIRInstructionClass.create(SPARCBitManipulationOp.class); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
44 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
45 public enum IntrinsicOpcode { |
14908
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14847
diff
changeset
|
46 IPOPCNT, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14847
diff
changeset
|
47 LPOPCNT, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14847
diff
changeset
|
48 IBSR, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14847
diff
changeset
|
49 LBSR, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14847
diff
changeset
|
50 BSF; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
51 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
52 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
53 @Opcode private final IntrinsicOpcode opcode; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
54 @Def protected AllocatableValue result; |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16346
diff
changeset
|
55 @Alive({REG}) protected AllocatableValue input; |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16346
diff
changeset
|
56 @Temp({REG}) protected Value scratch; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
57 |
14847
c132602c640e
Apply LIRGenerator refactoring to SPARC backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
58 public SPARCBitManipulationOp(IntrinsicOpcode opcode, AllocatableValue result, AllocatableValue input, LIRGeneratorTool gen) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
16938
diff
changeset
|
59 super(TYPE); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
60 this.opcode = opcode; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
61 this.result = result; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
62 this.input = input; |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16346
diff
changeset
|
63 scratch = gen.newVariable(LIRKind.derive(input)); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
64 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
65 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
66 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12503
diff
changeset
|
67 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
11233 | 68 Register dst = asIntReg(result); |
69 if (isRegister(input)) { | |
70 Register src = asRegister(input); | |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
71 switch (opcode) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
72 case IPOPCNT: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
73 // clear upper word for 64 bit POPC |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
74 masm.srl(src, g0, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
75 masm.popc(dst, dst); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
76 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
77 case LPOPCNT: |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
78 masm.popc(src, dst); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
79 break; |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
80 case BSF: |
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
81 Kind tkind = input.getKind(); |
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
82 if (tkind == Kind.Int) { |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
83 masm.sub(src, 1, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
84 masm.andn(dst, src, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
85 masm.srl(dst, g0, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
86 masm.popc(dst, dst); |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
87 } else if (tkind == Kind.Long) { |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
88 masm.sub(src, 1, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
89 masm.andn(dst, src, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
90 masm.popc(dst, dst); |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
91 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19678
diff
changeset
|
92 throw JVMCIError.shouldNotReachHere("missing: " + tkind); |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
93 } |
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
94 break; |
11233 | 95 case IBSR: { |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
96 Kind ikind = input.getKind(); |
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
97 assert ikind == Kind.Int; |
11233 | 98 Register tmp = asRegister(scratch); |
16932
4d77f938aa02
[SPARC] Exclude AMD64 tests from SPARC testrun, always use tmp register when using StrategySwitch, using registerSaver in EnterUnpackStackFrame, LeaveCurrentStackframe, adding guarantee to load offsets when doing load reg+imm13 when the imm value does not fit in 13 bit, assertions for scratch register usage (tmp/def)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16519
diff
changeset
|
99 assert !tmp.equals(dst); |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
100 masm.srl(src, 1, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
101 masm.srl(src, 0, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
102 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
103 masm.srl(dst, 2, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
104 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
105 masm.srl(dst, 4, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
106 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
107 masm.srl(dst, 8, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
108 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
109 masm.srl(dst, 16, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
110 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
111 masm.popc(dst, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
112 masm.sub(dst, 1, dst); |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
113 break; |
11233 | 114 } |
115 case LBSR: { | |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
116 Kind lkind = input.getKind(); |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16346
diff
changeset
|
117 assert lkind == Kind.Long; |
11233 | 118 Register tmp = asRegister(scratch); |
16932
4d77f938aa02
[SPARC] Exclude AMD64 tests from SPARC testrun, always use tmp register when using StrategySwitch, using registerSaver in EnterUnpackStackFrame, LeaveCurrentStackframe, adding guarantee to load offsets when doing load reg+imm13 when the imm value does not fit in 13 bit, assertions for scratch register usage (tmp/def)
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16519
diff
changeset
|
119 assert !tmp.equals(dst); |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
120 masm.srlx(src, 1, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
121 masm.or(src, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
122 masm.srlx(dst, 2, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
123 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
124 masm.srlx(dst, 4, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
125 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
126 masm.srlx(dst, 8, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
127 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
128 masm.srlx(dst, 16, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
129 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
130 masm.srlx(dst, 32, tmp); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
131 masm.or(dst, tmp, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
132 masm.popc(dst, dst); |
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
133 masm.sub(dst, 1, dst); // This is required to fit the given structure. |
9949
41511d78546a
SPARC UA 2011 assembler changes, bit manipulation synthetics
Morris Meyer <morris.meyer@oracle.com>
parents:
9856
diff
changeset
|
134 break; |
11233 | 135 } |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
136 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19678
diff
changeset
|
137 throw JVMCIError.shouldNotReachHere(); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
138 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
139 } |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
12503
diff
changeset
|
140 } else if (isConstant(input) && isSimm13(crb.asIntConst(input))) { |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
141 switch (opcode) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
142 case IPOPCNT: |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
143 masm.popc(crb.asIntConst(input), dst); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
144 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
145 case LPOPCNT: |
19675
f1b4f2613702
[SPARC] Change arithmetic ops of SPARC to functions in assembler
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16938
diff
changeset
|
146 masm.popc(crb.asIntConst(input), dst); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
147 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
148 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19678
diff
changeset
|
149 throw JVMCIError.shouldNotReachHere(); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
150 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
151 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19678
diff
changeset
|
152 throw JVMCIError.shouldNotReachHere(); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
153 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
154 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
155 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
156 } |