1 /* 2 * Copyright (c) 2020, 2024, 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_X86_C2_MACROASSEMBLER_X86_HPP 26 #define CPU_X86_C2_MACROASSEMBLER_X86_HPP 27 28 // C2_MacroAssembler contains high-level macros for C2 29 30 public: 31 // C2 compiled method's prolog code. 32 void verified_entry(Compile* C, int sp_inc = 0); 33 34 void entry_barrier(); 35 Assembler::AvxVectorLen vector_length_encoding(int vlen_in_bytes); 36 37 // Code used by cmpFastLock and cmpFastUnlock mach instructions in .ad file. 38 // See full description in macroAssembler_x86.cpp. 39 void fast_lock(Register obj, Register box, Register tmp, 40 Register scr, Register cx1, Register cx2, Register thread, 41 Metadata* method_data); 42 void fast_unlock(Register obj, Register box, Register tmp); 43 44 void fast_lock_lightweight(Register obj, Register box, Register rax_reg, 45 Register t, Register thread); 46 void fast_unlock_lightweight(Register obj, Register reg_rax, Register t, Register thread); 47 48 // Generic instructions support for use in .ad files C2 code generation 49 void vabsnegd(int opcode, XMMRegister dst, XMMRegister src); 50 void vabsnegd(int opcode, XMMRegister dst, XMMRegister src, int vector_len); 51 void vabsnegf(int opcode, XMMRegister dst, XMMRegister src); 52 void vabsnegf(int opcode, XMMRegister dst, XMMRegister src, int vector_len); 53 54 void pminmax(int opcode, BasicType elem_bt, XMMRegister dst, XMMRegister src, 55 XMMRegister tmp = xnoreg); 56 void vpminmax(int opcode, BasicType elem_bt, 57 XMMRegister dst, XMMRegister src1, XMMRegister src2, 58 int vlen_enc); 59 60 void vpuminmax(int opcode, BasicType elem_bt, 61 XMMRegister dst, XMMRegister src1, XMMRegister src2, 62 int vlen_enc); 63 64 void vpuminmax(int opcode, BasicType elem_bt, 65 XMMRegister dst, XMMRegister src1, Address src2, 66 int vlen_enc); 67 68 void vminmax_fp(int opcode, BasicType elem_bt, 69 XMMRegister dst, XMMRegister a, XMMRegister b, 70 XMMRegister tmp, XMMRegister atmp, XMMRegister btmp, 71 int vlen_enc); 72 73 void vpuminmaxq(int opcode, XMMRegister dst, XMMRegister src1, XMMRegister src2, XMMRegister xtmp1, XMMRegister xtmp2, int vlen_enc); 74 75 void evminmax_fp(int opcode, BasicType elem_bt, 76 XMMRegister dst, XMMRegister a, XMMRegister b, 77 KRegister ktmp, XMMRegister atmp, XMMRegister btmp, 78 int vlen_enc); 79 80 void signum_fp(int opcode, XMMRegister dst, XMMRegister zero, XMMRegister one); 81 82 void vector_compress_expand(int opcode, XMMRegister dst, XMMRegister src, KRegister mask, 83 bool merge, BasicType bt, int vec_enc); 84 85 void vector_mask_compress(KRegister dst, KRegister src, Register rtmp1, Register rtmp2, int mask_len); 86 87 void vextendbw(bool sign, XMMRegister dst, XMMRegister src, int vector_len); 88 void vextendbw(bool sign, XMMRegister dst, XMMRegister src); 89 void vextendbd(bool sign, XMMRegister dst, XMMRegister src, int vector_len); 90 void vextendwd(bool sign, XMMRegister dst, XMMRegister src, int vector_len); 91 92 void vshiftd(int opcode, XMMRegister dst, XMMRegister shift); 93 void vshiftd_imm(int opcode, XMMRegister dst, int shift); 94 void vshiftd(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vlen_enc); 95 void vshiftd_imm(int opcode, XMMRegister dst, XMMRegister nds, int shift, int vector_len); 96 void vshiftw(int opcode, XMMRegister dst, XMMRegister shift); 97 void vshiftw(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vlen_enc); 98 void vshiftq(int opcode, XMMRegister dst, XMMRegister shift); 99 void vshiftq_imm(int opcode, XMMRegister dst, int shift); 100 void vshiftq(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vlen_enc); 101 void vshiftq_imm(int opcode, XMMRegister dst, XMMRegister nds, int shift, int vector_len); 102 103 void vprotate_imm(int opcode, BasicType etype, XMMRegister dst, XMMRegister src, int shift, int vector_len); 104 void vprotate_var(int opcode, BasicType etype, XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len); 105 106 void varshiftd(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vlen_enc); 107 void varshiftw(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vlen_enc); 108 void varshiftq(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vlen_enc, XMMRegister vtmp = xnoreg); 109 void varshiftbw(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len, XMMRegister vtmp); 110 void evarshiftb(int opcode, XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len, XMMRegister vtmp); 111 112 void insert(BasicType typ, XMMRegister dst, Register val, int idx); 113 void vinsert(BasicType typ, XMMRegister dst, XMMRegister src, Register val, int idx); 114 void vgather(BasicType typ, XMMRegister dst, Register base, XMMRegister idx, XMMRegister mask, int vector_len); 115 void evgather(BasicType typ, XMMRegister dst, KRegister mask, Register base, XMMRegister idx, int vector_len); 116 void evscatter(BasicType typ, Register base, XMMRegister idx, KRegister mask, XMMRegister src, int vector_len); 117 118 void evmovdqu(BasicType type, KRegister kmask, XMMRegister dst, Address src, bool merge, int vector_len); 119 void evmovdqu(BasicType type, KRegister kmask, Address dst, XMMRegister src, bool merge, int vector_len); 120 void evmovdqu(BasicType type, KRegister kmask, XMMRegister dst, XMMRegister src, bool merge, int vector_len); 121 122 // extract 123 void extract(BasicType typ, Register dst, XMMRegister src, int idx); 124 XMMRegister get_lane(BasicType typ, XMMRegister dst, XMMRegister src, int elemindex); 125 void get_elem(BasicType typ, Register dst, XMMRegister src, int elemindex); 126 void get_elem(BasicType typ, XMMRegister dst, XMMRegister src, int elemindex, XMMRegister vtmp = xnoreg); 127 void movsxl(BasicType typ, Register dst); 128 129 // vector test 130 void vectortest(BasicType bt, XMMRegister src1, XMMRegister src2, XMMRegister vtmp, int vlen_in_bytes); 131 132 // Covert B2X 133 void vconvert_b2x(BasicType to_elem_bt, XMMRegister dst, XMMRegister src, int vlen_enc); 134 #ifdef _LP64 135 void vpbroadcast(BasicType elem_bt, XMMRegister dst, Register src, int vlen_enc); 136 #endif 137 138 // blend 139 void evpcmp(BasicType typ, KRegister kdmask, KRegister ksmask, XMMRegister src1, XMMRegister src2, int comparison, int vector_len); 140 void evpcmp(BasicType typ, KRegister kdmask, KRegister ksmask, XMMRegister src1, AddressLiteral src2, int comparison, int vector_len, Register rscratch = noreg); 141 void evpblend(BasicType typ, XMMRegister dst, KRegister kmask, XMMRegister src1, XMMRegister src2, bool merge, int vector_len); 142 143 void load_vector(XMMRegister dst, Address src, int vlen_in_bytes); 144 void load_vector(XMMRegister dst, AddressLiteral src, int vlen_in_bytes, Register rscratch = noreg); 145 146 void load_vector_mask(XMMRegister dst, XMMRegister src, int vlen_in_bytes, BasicType elem_bt, bool is_legacy); 147 void load_vector_mask(KRegister dst, XMMRegister src, XMMRegister xtmp, bool novlbwdq, int vlen_enc); 148 149 void load_constant_vector(BasicType bt, XMMRegister dst, InternalAddress src, int vlen); 150 void load_iota_indices(XMMRegister dst, int vlen_in_bytes, BasicType bt); 151 152 // Reductions for vectors of bytes, shorts, ints, longs, floats, and doubles. 153 154 // dst = src1 reduce(op, src2) using vtmp as temps 155 void reduceI(int opcode, int vlen, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 156 #ifdef _LP64 157 void reduceL(int opcode, int vlen, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 158 void genmask(KRegister dst, Register len, Register temp); 159 #endif // _LP64 160 161 // dst = reduce(op, src2) using vtmp as temps 162 void reduce_fp(int opcode, int vlen, 163 XMMRegister dst, XMMRegister src, 164 XMMRegister vtmp1, XMMRegister vtmp2 = xnoreg); 165 void unordered_reduce_fp(int opcode, int vlen, 166 XMMRegister dst, XMMRegister src, 167 XMMRegister vtmp1 = xnoreg, XMMRegister vtmp2 = xnoreg); 168 void reduceB(int opcode, int vlen, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 169 void mulreduceB(int opcode, int vlen, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 170 void reduceS(int opcode, int vlen, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 171 void reduceFloatMinMax(int opcode, int vlen, bool is_dst_valid, 172 XMMRegister dst, XMMRegister src, 173 XMMRegister tmp, XMMRegister atmp, XMMRegister btmp, XMMRegister xmm_0, XMMRegister xmm_1 = xnoreg); 174 void reduceDoubleMinMax(int opcode, int vlen, bool is_dst_valid, 175 XMMRegister dst, XMMRegister src, 176 XMMRegister tmp, XMMRegister atmp, XMMRegister btmp, XMMRegister xmm_0, XMMRegister xmm_1 = xnoreg); 177 private: 178 void reduceF(int opcode, int vlen, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 179 void reduceD(int opcode, int vlen, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 180 void unorderedReduceF(int opcode, int vlen, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 181 void unorderedReduceD(int opcode, int vlen, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 182 183 // Int Reduction 184 void reduce2I (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 185 void reduce4I (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 186 void reduce8I (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 187 void reduce16I(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 188 189 // Byte Reduction 190 void reduce8B (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 191 void reduce16B(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 192 void reduce32B(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 193 void reduce64B(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 194 void mulreduce8B (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 195 void mulreduce16B(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 196 void mulreduce32B(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 197 void mulreduce64B(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 198 199 // Short Reduction 200 void reduce4S (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 201 void reduce8S (int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 202 void reduce16S(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 203 void reduce32S(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 204 205 // Long Reduction 206 #ifdef _LP64 207 void reduce2L(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 208 void reduce4L(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 209 void reduce8L(int opcode, Register dst, Register src1, XMMRegister src2, XMMRegister vtmp1, XMMRegister vtmp2); 210 #endif // _LP64 211 212 // Float Reduction 213 void reduce2F (int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp); 214 void reduce4F (int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp); 215 void reduce8F (int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 216 void reduce16F(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 217 218 // Unordered Float Reduction 219 void unorderedReduce2F(int opcode, XMMRegister dst, XMMRegister src); 220 void unorderedReduce4F(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp); 221 void unorderedReduce8F(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 222 void unorderedReduce16F(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 223 224 // Double Reduction 225 void reduce2D(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp); 226 void reduce4D(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 227 void reduce8D(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 228 229 // Unordered Double Reduction 230 void unorderedReduce2D(int opcode, XMMRegister dst, XMMRegister src); 231 void unorderedReduce4D(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp); 232 void unorderedReduce8D(int opcode, XMMRegister dst, XMMRegister src, XMMRegister vtmp1, XMMRegister vtmp2); 233 234 // Base reduction instruction 235 void reduce_operation_128(BasicType typ, int opcode, XMMRegister dst, XMMRegister src); 236 void reduce_operation_256(BasicType typ, int opcode, XMMRegister dst, XMMRegister src1, XMMRegister src2); 237 void unordered_reduce_operation_128(BasicType typ, int opcode, XMMRegister dst, XMMRegister src); 238 void unordered_reduce_operation_256(BasicType typ, int opcode, XMMRegister dst, XMMRegister src1, XMMRegister src2); 239 240 public: 241 #ifdef _LP64 242 void vector_mask_operation_helper(int opc, Register dst, Register tmp, int masklen); 243 244 void vector_mask_operation(int opc, Register dst, KRegister mask, Register tmp, int masklen, int masksize, int vec_enc); 245 246 void vector_mask_operation(int opc, Register dst, XMMRegister mask, XMMRegister xtmp, 247 Register tmp, int masklen, BasicType bt, int vec_enc); 248 void vector_long_to_maskvec(XMMRegister dst, Register src, Register rtmp1, 249 Register rtmp2, XMMRegister xtmp, int mask_len, int vec_enc); 250 #endif 251 252 void vector_maskall_operation(KRegister dst, Register src, int mask_len); 253 254 #ifndef _LP64 255 void vector_maskall_operation32(KRegister dst, Register src, KRegister ktmp, int mask_len); 256 #endif 257 258 void string_indexof_char(Register str1, Register cnt1, Register ch, Register result, 259 XMMRegister vec1, XMMRegister vec2, XMMRegister vec3, Register tmp); 260 261 void stringL_indexof_char(Register str1, Register cnt1, Register ch, Register result, 262 XMMRegister vec1, XMMRegister vec2, XMMRegister vec3, Register tmp); 263 264 // IndexOf strings. 265 // Small strings are loaded through stack if they cross page boundary. 266 void string_indexof(Register str1, Register str2, 267 Register cnt1, Register cnt2, 268 int int_cnt2, Register result, 269 XMMRegister vec, Register tmp, 270 int ae); 271 272 // IndexOf for constant substrings with size >= 8 elements 273 // which don't need to be loaded through stack. 274 void string_indexofC8(Register str1, Register str2, 275 Register cnt1, Register cnt2, 276 int int_cnt2, Register result, 277 XMMRegister vec, Register tmp, 278 int ae); 279 280 // Smallest code: we don't need to load through stack, 281 // check string tail. 282 283 // helper function for string_compare 284 void load_next_elements(Register elem1, Register elem2, Register str1, Register str2, 285 Address::ScaleFactor scale, Address::ScaleFactor scale1, 286 Address::ScaleFactor scale2, Register index, int ae); 287 // Compare strings. 288 void string_compare(Register str1, Register str2, 289 Register cnt1, Register cnt2, Register result, 290 XMMRegister vec1, int ae, KRegister mask = knoreg); 291 292 // Search for Non-ASCII character (Negative byte value) in a byte array, 293 // return index of the first such character, otherwise len. 294 void count_positives(Register ary1, Register len, 295 Register result, Register tmp1, 296 XMMRegister vec1, XMMRegister vec2, KRegister mask1 = knoreg, KRegister mask2 = knoreg); 297 298 // Compare char[] or byte[] arrays. 299 void arrays_equals(bool is_array_equ, Register ary1, Register ary2, Register limit, 300 Register result, Register chr, XMMRegister vec1, XMMRegister vec2, 301 bool is_char, KRegister mask = knoreg, bool expand_ary2 = false); 302 303 void arrays_hashcode(Register str1, Register cnt1, Register result, 304 Register tmp1, Register tmp2, Register tmp3, XMMRegister vnext, 305 XMMRegister vcoef0, XMMRegister vcoef1, XMMRegister vcoef2, XMMRegister vcoef3, 306 XMMRegister vresult0, XMMRegister vresult1, XMMRegister vresult2, XMMRegister vresult3, 307 XMMRegister vtmp0, XMMRegister vtmp1, XMMRegister vtmp2, XMMRegister vtmp3, 308 BasicType eltype); 309 310 // helper functions for arrays_hashcode 311 int arrays_hashcode_elsize(BasicType eltype); 312 void arrays_hashcode_elload(Register dst, Address src, BasicType eltype); 313 void arrays_hashcode_elvload(XMMRegister dst, Address src, BasicType eltype); 314 void arrays_hashcode_elvload(XMMRegister dst, AddressLiteral src, BasicType eltype); 315 void arrays_hashcode_elvcast(XMMRegister dst, BasicType eltype); 316 317 #ifdef _LP64 318 void convertF2I(BasicType dst_bt, BasicType src_bt, Register dst, XMMRegister src); 319 #endif 320 321 void evmasked_op(int ideal_opc, BasicType eType, KRegister mask, 322 XMMRegister dst, XMMRegister src1, XMMRegister src2, 323 bool merge, int vlen_enc, bool is_varshift = false); 324 325 void evmasked_op(int ideal_opc, BasicType eType, KRegister mask, 326 XMMRegister dst, XMMRegister src1, Address src2, 327 bool merge, int vlen_enc); 328 329 void evmasked_op(int ideal_opc, BasicType eType, KRegister mask, XMMRegister dst, 330 XMMRegister src1, int imm8, bool merge, int vlen_enc); 331 332 void masked_op(int ideal_opc, int mask_len, KRegister dst, 333 KRegister src1, KRegister src2); 334 335 void vector_unsigned_cast(XMMRegister dst, XMMRegister src, int vlen_enc, 336 BasicType from_elem_bt, BasicType to_elem_bt); 337 338 void vector_signed_cast(XMMRegister dst, XMMRegister src, int vlen_enc, 339 BasicType from_elem_bt, BasicType to_elem_bt); 340 341 void vector_cast_int_to_subword(BasicType to_elem_bt, XMMRegister dst, XMMRegister zero, 342 XMMRegister xtmp, Register rscratch, int vec_enc); 343 344 void vector_castF2X_avx(BasicType to_elem_bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 345 XMMRegister xtmp2, XMMRegister xtmp3, XMMRegister xtmp4, 346 AddressLiteral float_sign_flip, Register rscratch, int vec_enc); 347 348 void vector_castF2X_evex(BasicType to_elem_bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 349 XMMRegister xtmp2, KRegister ktmp1, KRegister ktmp2, AddressLiteral float_sign_flip, 350 Register rscratch, int vec_enc); 351 352 void vector_castF2L_evex(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 353 KRegister ktmp1, KRegister ktmp2, AddressLiteral double_sign_flip, 354 Register rscratch, int vec_enc); 355 356 void vector_castD2X_evex(BasicType to_elem_bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 357 XMMRegister xtmp2, KRegister ktmp1, KRegister ktmp2, AddressLiteral sign_flip, 358 Register rscratch, int vec_enc); 359 360 void vector_castD2X_avx(BasicType to_elem_bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 361 XMMRegister xtmp2, XMMRegister xtmp3, XMMRegister xtmp4, XMMRegister xtmp5, 362 AddressLiteral float_sign_flip, Register rscratch, int vec_enc); 363 364 365 void vector_cast_double_to_int_special_cases_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 366 XMMRegister xtmp3, XMMRegister xtmp4, XMMRegister xtmp5, Register rscratch, 367 AddressLiteral float_sign_flip, int vec_enc); 368 369 void vector_cast_double_to_int_special_cases_evex(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 370 KRegister ktmp1, KRegister ktmp2, Register rscratch, AddressLiteral float_sign_flip, 371 int vec_enc); 372 373 void vector_cast_double_to_long_special_cases_evex(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 374 KRegister ktmp1, KRegister ktmp2, Register rscratch, AddressLiteral double_sign_flip, 375 int vec_enc); 376 377 void vector_cast_float_to_int_special_cases_evex(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 378 KRegister ktmp1, KRegister ktmp2, Register rscratch, AddressLiteral float_sign_flip, 379 int vec_enc); 380 381 void vector_cast_float_to_long_special_cases_evex(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 382 KRegister ktmp1, KRegister ktmp2, Register rscratch, AddressLiteral double_sign_flip, 383 int vec_enc); 384 385 void vector_cast_float_to_int_special_cases_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, 386 XMMRegister xtmp4, Register rscratch, AddressLiteral float_sign_flip, 387 int vec_enc); 388 389 void vector_crosslane_doubleword_pack_avx(XMMRegister dst, XMMRegister src, XMMRegister zero, 390 XMMRegister xtmp, int index, int vec_enc); 391 392 void vector_mask_cast(XMMRegister dst, XMMRegister src, BasicType dst_bt, BasicType src_bt, int vlen); 393 394 #ifdef _LP64 395 void vector_round_double_evex(XMMRegister dst, XMMRegister src, AddressLiteral double_sign_flip, AddressLiteral new_mxcsr, int vec_enc, 396 Register tmp, XMMRegister xtmp1, XMMRegister xtmp2, KRegister ktmp1, KRegister ktmp2); 397 398 void vector_round_float_evex(XMMRegister dst, XMMRegister src, AddressLiteral double_sign_flip, AddressLiteral new_mxcsr, int vec_enc, 399 Register tmp, XMMRegister xtmp1, XMMRegister xtmp2, KRegister ktmp1, KRegister ktmp2); 400 401 void vector_round_float_avx(XMMRegister dst, XMMRegister src, AddressLiteral float_sign_flip, AddressLiteral new_mxcsr, int vec_enc, 402 Register tmp, XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, XMMRegister xtmp4); 403 404 void vector_compress_expand_avx2(int opcode, XMMRegister dst, XMMRegister src, XMMRegister mask, 405 Register rtmp, Register rscratch, XMMRegister permv, XMMRegister xtmp, 406 BasicType bt, int vec_enc); 407 #endif // _LP64 408 409 void udivI(Register rax, Register divisor, Register rdx); 410 void umodI(Register rax, Register divisor, Register rdx); 411 void udivmodI(Register rax, Register divisor, Register rdx, Register tmp); 412 413 #ifdef _LP64 414 void reverseI(Register dst, Register src, XMMRegister xtmp1, 415 XMMRegister xtmp2, Register rtmp); 416 void reverseL(Register dst, Register src, XMMRegister xtmp1, 417 XMMRegister xtmp2, Register rtmp1, Register rtmp2); 418 void udivL(Register rax, Register divisor, Register rdx); 419 void umodL(Register rax, Register divisor, Register rdx); 420 void udivmodL(Register rax, Register divisor, Register rdx, Register tmp); 421 #endif 422 423 void evpternlog(XMMRegister dst, int func, KRegister mask, XMMRegister src2, XMMRegister src3, 424 bool merge, BasicType bt, int vlen_enc); 425 426 void evpternlog(XMMRegister dst, int func, KRegister mask, XMMRegister src2, Address src3, 427 bool merge, BasicType bt, int vlen_enc); 428 429 void vector_reverse_bit(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 430 XMMRegister xtmp2, Register rtmp, int vec_enc); 431 432 void vector_reverse_bit_gfni(BasicType bt, XMMRegister dst, XMMRegister src, AddressLiteral mask, int vec_enc, 433 XMMRegister xtmp, Register rscratch = noreg); 434 435 void vector_reverse_byte(BasicType bt, XMMRegister dst, XMMRegister src, int vec_enc); 436 437 void vector_popcount_int(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 438 XMMRegister xtmp2, Register rtmp, int vec_enc); 439 440 void vector_popcount_long(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 441 XMMRegister xtmp2, Register rtmp, int vec_enc); 442 443 void vector_popcount_short(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 444 XMMRegister xtmp2, Register rtmp, int vec_enc); 445 446 void vector_popcount_byte(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 447 XMMRegister xtmp2, Register rtmp, int vec_enc); 448 449 void vector_popcount_integral(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 450 XMMRegister xtmp2, Register rtmp, int vec_enc); 451 452 void vector_popcount_integral_evex(BasicType bt, XMMRegister dst, XMMRegister src, 453 KRegister mask, bool merge, int vec_enc); 454 455 void vbroadcast(BasicType bt, XMMRegister dst, int imm32, Register rtmp, int vec_enc); 456 457 void vector_reverse_byte64(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 458 XMMRegister xtmp2, Register rtmp, int vec_enc); 459 460 void vector_count_leading_zeros_evex(BasicType bt, XMMRegister dst, XMMRegister src, 461 XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, 462 KRegister ktmp, Register rtmp, bool merge, int vec_enc); 463 464 void vector_count_leading_zeros_byte_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 465 XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); 466 467 void vector_count_leading_zeros_short_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 468 XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); 469 470 void vector_count_leading_zeros_int_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 471 XMMRegister xtmp2, XMMRegister xtmp3, int vec_enc); 472 473 void vector_count_leading_zeros_long_avx(XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 474 XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); 475 476 void vector_count_leading_zeros_avx(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 477 XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); 478 479 void vpadd(BasicType bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vec_enc); 480 481 void vpsub(BasicType bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vec_enc); 482 483 void vector_count_trailing_zeros_evex(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 484 XMMRegister xtmp2, XMMRegister xtmp3, XMMRegister xtmp4, KRegister ktmp, 485 Register rtmp, int vec_enc); 486 487 void vector_swap_nbits(int nbits, int bitmask, XMMRegister dst, XMMRegister src, 488 XMMRegister xtmp1, Register rtmp, int vec_enc); 489 490 void vector_count_trailing_zeros_avx(BasicType bt, XMMRegister dst, XMMRegister src, XMMRegister xtmp1, 491 XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, int vec_enc); 492 493 void vector_signum_avx(int opcode, XMMRegister dst, XMMRegister src, XMMRegister zero, XMMRegister one, 494 XMMRegister xtmp1, int vec_enc); 495 496 void vector_signum_evex(int opcode, XMMRegister dst, XMMRegister src, XMMRegister zero, XMMRegister one, 497 KRegister ktmp1, int vec_enc); 498 499 void vmovmask(BasicType elem_bt, XMMRegister dst, Address src, XMMRegister mask, int vec_enc); 500 501 void vmovmask(BasicType elem_bt, Address dst, XMMRegister src, XMMRegister mask, int vec_enc); 502 503 void rearrange_bytes(XMMRegister dst, XMMRegister shuffle, XMMRegister src, XMMRegister xtmp1, 504 XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, KRegister ktmp, int vlen_enc); 505 506 void vector_rearrange_int_float(BasicType bt, XMMRegister dst, XMMRegister shuffle, 507 XMMRegister src, int vlen_enc); 508 509 510 void vgather_subword(BasicType elem_ty, XMMRegister dst, Register base, Register idx_base, Register offset, 511 Register mask, XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, Register rtmp, 512 Register midx, Register length, int vector_len, int vlen_enc); 513 514 #ifdef _LP64 515 void vgather8b_masked_offset(BasicType elem_bt, XMMRegister dst, Register base, Register idx_base, 516 Register offset, Register mask, Register midx, Register rtmp, int vlen_enc); 517 #endif 518 void vgather8b_offset(BasicType elem_bt, XMMRegister dst, Register base, Register idx_base, 519 Register offset, Register rtmp, int vlen_enc); 520 521 void vector_saturating_op(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, bool is_unsigned, int vlen_enc); 522 523 void vector_saturating_op(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, Address src2, bool is_unsigned, int vlen_enc); 524 525 void vector_saturating_op(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vlen_enc); 526 527 void vector_saturating_op(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, Address src2, int vlen_enc); 528 529 void vector_saturating_unsigned_op(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vlen_enc); 530 531 void vector_saturating_unsigned_op(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, Address src2, int vlen_enc); 532 533 void vector_sub_dq_saturating_unsigned_evex(BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, KRegister ktmp, int vlen_enc); 534 535 void vector_sub_dq_saturating_unsigned_avx(BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, 536 XMMRegister xtmp1, XMMRegister xtmp2, int vlen_enc); 537 538 void vector_add_dq_saturating_unsigned_evex(BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, 539 XMMRegister xtmp1, XMMRegister xtmp2, KRegister ktmp, int vlen_enc); 540 541 void vector_add_dq_saturating_unsigned_avx(BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, 542 XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, int vlen_enc); 543 544 void vector_addsub_dq_saturating_avx(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, 545 XMMRegister xtmp1, XMMRegister xtmp2, XMMRegister xtmp3, XMMRegister xtmp4, int vlen_enc); 546 547 void vector_addsub_dq_saturating_evex(int opc, BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, 548 XMMRegister xtmp1, XMMRegister xtmp2, KRegister ktmp1, KRegister ktmp2, int vlen_enc); 549 550 void evpmovd2m_emu(KRegister ktmp, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, int vlen_enc, bool xtmp2_hold_M1 = false); 551 552 void evpmovq2m_emu(KRegister ktmp, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, int vlen_enc, bool xtmp2_hold_M1 = false); 553 554 void vpsign_extend_dq(BasicType etype, XMMRegister dst, XMMRegister src, int vlen_enc); 555 556 void vpgenmin_value(BasicType etype, XMMRegister dst, XMMRegister allones, int vlen_enc, bool compute_allones = false); 557 558 void vpgenmax_value(BasicType etype, XMMRegister dst, XMMRegister allones, int vlen_enc, bool compute_allones = false); 559 560 void evpcmpu(BasicType etype, KRegister kmask, XMMRegister src1, XMMRegister src2, Assembler::ComparisonPredicate cond, int vlen_enc); 561 562 void vpcmpgt(BasicType etype, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vlen_enc); 563 564 void evpmov_vec_to_mask(BasicType etype, KRegister ktmp, XMMRegister src, XMMRegister xtmp1, XMMRegister xtmp2, 565 int vlen_enc, bool xtmp2_hold_M1 = false); 566 567 void evmasked_saturating_op(int ideal_opc, BasicType elem_bt, KRegister mask, XMMRegister dst, XMMRegister src1, XMMRegister src2, 568 bool is_unsigned, bool merge, int vlen_enc); 569 570 void evmasked_saturating_op(int ideal_opc, BasicType elem_bt, KRegister mask, XMMRegister dst, XMMRegister src1, Address src2, 571 bool is_unsigned, bool merge, int vlen_enc); 572 573 void evmasked_saturating_signed_op(int ideal_opc, BasicType elem_bt, KRegister mask, XMMRegister dst, XMMRegister src1, XMMRegister src2, 574 bool merge, int vlen_enc); 575 576 void evmasked_saturating_signed_op(int ideal_opc, BasicType elem_bt, KRegister mask, XMMRegister dst, XMMRegister src1, Address src2, 577 bool merge, int vlen_enc); 578 579 void evmasked_saturating_unsigned_op(int ideal_opc, BasicType elem_bt, KRegister mask, XMMRegister dst, XMMRegister src1, 580 XMMRegister src2, bool merge, int vlen_enc); 581 582 void evmasked_saturating_unsigned_op(int ideal_opc, BasicType elem_bt, KRegister mask, XMMRegister dst, XMMRegister src1, 583 Address src2, bool merge, int vlen_enc); 584 585 void select_from_two_vectors_evex(BasicType elem_bt, XMMRegister dst, XMMRegister src1, XMMRegister src2, int vlen_enc); 586 587 #endif // CPU_X86_C2_MACROASSEMBLER_X86_HPP