1 /*
 2  * Copyright (c) 2020, 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  */
24 
25 #ifndef CPU_PPC_C2_MACROASSEMBLER_PPC_HPP
26 #define CPU_PPC_C2_MACROASSEMBLER_PPC_HPP
27 
28 // C2_MacroAssembler contains high-level macros for C2
29 
30  public:
31   // Intrinsics for CompactStrings
32   // Compress char[] to byte[] by compressing 16 bytes at once.
33   void string_compress_16(Register src, Register dst, Register cnt,
34                           Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
35                           Label& Lfailure, bool ascii = false);
36 
37   // Compress char[] to byte[]. cnt must be positive int.
38   void string_compress(Register src, Register dst, Register cnt, Register tmp,
39                        Label& Lfailure, bool ascii = false);
40 
41   // Encode UTF16 to ISO_8859_1 or ASCII. Return len on success or position of first mismatch.
42   void encode_iso_array(Register src, Register dst, Register len,
43                         Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
44                         Register result, bool ascii);
45 
46   // Inflate byte[] to char[] by inflating 16 bytes at once.
47   void string_inflate_16(Register src, Register dst, Register cnt,
48                          Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5);
49 
50   // Inflate byte[] to char[]. cnt must be positive int.
51   void string_inflate(Register src, Register dst, Register cnt, Register tmp);
52 
53   void string_compare(Register str1, Register str2, Register cnt1, Register cnt2,
54                       Register tmp1, Register result, int ae);
55 
56   void array_equals(bool is_array_equ, Register ary1, Register ary2,
57                     Register limit, Register tmp1, Register result, bool is_byte);
58 
59   void string_indexof(Register result, Register haystack, Register haycnt,
60                       Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
61                       Register tmp1, Register tmp2, Register tmp3, Register tmp4, int ae);
62 
63   void string_indexof_char(Register result, Register haystack, Register haycnt,
64                            Register needle, jchar needleChar, Register tmp1, Register tmp2, bool is_byte);
65 
66   void count_positives(Register src, Register cnt, Register result, Register tmp1, Register tmp2);
67 
68 #endif // CPU_PPC_C2_MACROASSEMBLER_PPC_HPP