2 * Copyright (C) 2009 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /* Forward decalraton the portable versions due to circular dependency */
18 static bool genArithOpFloatPortable(CompilationUnit *cUnit, MIR *mir,
19 RegLocation rlDest, RegLocation rlSrc1,
22 static bool genArithOpDoublePortable(CompilationUnit *cUnit, MIR *mir,
23 RegLocation rlDest, RegLocation rlSrc1,
26 static bool genConversionPortable(CompilationUnit *cUnit, MIR *mir);
28 static bool genConversion(CompilationUnit *cUnit, MIR *mir)
30 return genConversionPortable(cUnit, mir);
33 static bool genArithOpFloat(CompilationUnit *cUnit, MIR *mir,
34 RegLocation rlDest, RegLocation rlSrc1,
37 return genArithOpFloatPortable(cUnit, mir, rlDest, rlSrc1, rlSrc2);
40 static bool genArithOpDouble(CompilationUnit *cUnit, MIR *mir,
41 RegLocation rlDest, RegLocation rlSrc1,
44 return genArithOpDoublePortable(cUnit, mir, rlDest, rlSrc1, rlSrc2);
47 static bool genInlineSqrt(CompilationUnit *cUnit, MIR *mir)
49 return false; /* punt to C handler */
52 static bool genCmpFP(CompilationUnit *cUnit, MIR *mir, RegLocation rlDest,
53 RegLocation rlSrc1, RegLocation rlSrc2)
55 RegLocation rlResult = LOC_C_RETURN;
57 * Don't attempt to optimize register usage since these opcodes call out to
60 switch (mir->dalvikInsn.opCode) {
62 loadValueDirectFixed(cUnit, rlSrc1, r0);
63 loadValueDirectFixed(cUnit, rlSrc2, r1);
64 genDispatchToHandler(cUnit, TEMPLATE_CMPL_FLOAT);
65 storeValue(cUnit, rlDest, rlResult);
68 loadValueDirectFixed(cUnit, rlSrc1, r0);
69 loadValueDirectFixed(cUnit, rlSrc2, r1);
70 genDispatchToHandler(cUnit, TEMPLATE_CMPG_FLOAT);
71 storeValue(cUnit, rlDest, rlResult);
74 loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
75 loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
76 genDispatchToHandler(cUnit, TEMPLATE_CMPL_DOUBLE);
77 storeValue(cUnit, rlDest, rlResult);
80 loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1);
81 loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3);
82 genDispatchToHandler(cUnit, TEMPLATE_CMPG_DOUBLE);
83 storeValue(cUnit, rlDest, rlResult);