1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 // Test for the optimizing compiler's parallel swap support in 18 // the presence of register pairs (in this case, doubles on ARM). 19 public class Main { 20 public static void main(String[] args) { 21 new Main().foo(); 22 } 23 24 public void foo() { 25 // Do multiple calls to force swapping of registers. Note that 26 // this depends on the calling convention, as a stack-only convention 27 // may not need the swapping. 28 callWithDoubles(a, b, c, d, e, f, g); 29 callWithDoubles(b, c, d, e, f, g, a); 30 callWithDoubles(c, d, e, f, g, a, b); 31 callWithDoubles(d, e, f, g, a, b, c); 32 } 33 34 public static void callWithDoubles( 35 double a, double b, double c, double d, double e, double f, double g) { 36 System.out.println(a - b - c - d - e - f - g); 37 } 38 39 double a = 1.0; 40 double b = 2.0; 41 double c = 3.0; 42 double d = 4.0; 43 double e = 5.0; 44 double f = 6.0; 45 double g = 7.0; 46 } 47