11cb0ef41Sopenharmony_ci// Copyright 2012 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_CODEGEN_IA32_SSE_INSTR_H_
61cb0ef41Sopenharmony_ci#define V8_CODEGEN_IA32_SSE_INSTR_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci// SSE/SSE2 instructions whose AVX version has two operands.
91cb0ef41Sopenharmony_ci#define SSE_UNOP_INSTRUCTION_LIST(V) \
101cb0ef41Sopenharmony_ci  V(sqrtps, 0F, 51)                  \
111cb0ef41Sopenharmony_ci  V(rsqrtps, 0F, 52)                 \
121cb0ef41Sopenharmony_ci  V(rcpps, 0F, 53)                   \
131cb0ef41Sopenharmony_ci  V(cvtps2pd, 0F, 5A)                \
141cb0ef41Sopenharmony_ci  V(cvtdq2ps, 0F, 5B)
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci#define SSE2_INSTRUCTION_LIST(V) \
171cb0ef41Sopenharmony_ci  V(packsswb, 66, 0F, 63)        \
181cb0ef41Sopenharmony_ci  V(packssdw, 66, 0F, 6B)        \
191cb0ef41Sopenharmony_ci  V(packuswb, 66, 0F, 67)        \
201cb0ef41Sopenharmony_ci  V(pmaddwd, 66, 0F, F5)         \
211cb0ef41Sopenharmony_ci  V(paddb, 66, 0F, FC)           \
221cb0ef41Sopenharmony_ci  V(paddw, 66, 0F, FD)           \
231cb0ef41Sopenharmony_ci  V(paddd, 66, 0F, FE)           \
241cb0ef41Sopenharmony_ci  V(paddq, 66, 0F, D4)           \
251cb0ef41Sopenharmony_ci  V(paddsb, 66, 0F, EC)          \
261cb0ef41Sopenharmony_ci  V(paddsw, 66, 0F, ED)          \
271cb0ef41Sopenharmony_ci  V(paddusb, 66, 0F, DC)         \
281cb0ef41Sopenharmony_ci  V(paddusw, 66, 0F, DD)         \
291cb0ef41Sopenharmony_ci  V(pand, 66, 0F, DB)            \
301cb0ef41Sopenharmony_ci  V(pandn, 66, 0F, DF)           \
311cb0ef41Sopenharmony_ci  V(pcmpeqb, 66, 0F, 74)         \
321cb0ef41Sopenharmony_ci  V(pcmpeqw, 66, 0F, 75)         \
331cb0ef41Sopenharmony_ci  V(pcmpeqd, 66, 0F, 76)         \
341cb0ef41Sopenharmony_ci  V(pcmpgtb, 66, 0F, 64)         \
351cb0ef41Sopenharmony_ci  V(pcmpgtw, 66, 0F, 65)         \
361cb0ef41Sopenharmony_ci  V(pcmpgtd, 66, 0F, 66)         \
371cb0ef41Sopenharmony_ci  V(pmaxsw, 66, 0F, EE)          \
381cb0ef41Sopenharmony_ci  V(pmaxub, 66, 0F, DE)          \
391cb0ef41Sopenharmony_ci  V(pminsw, 66, 0F, EA)          \
401cb0ef41Sopenharmony_ci  V(pminub, 66, 0F, DA)          \
411cb0ef41Sopenharmony_ci  V(pmullw, 66, 0F, D5)          \
421cb0ef41Sopenharmony_ci  V(por, 66, 0F, EB)             \
431cb0ef41Sopenharmony_ci  V(psllw, 66, 0F, F1)           \
441cb0ef41Sopenharmony_ci  V(pslld, 66, 0F, F2)           \
451cb0ef41Sopenharmony_ci  V(psllq, 66, 0F, F3)           \
461cb0ef41Sopenharmony_ci  V(pmuludq, 66, 0F, F4)         \
471cb0ef41Sopenharmony_ci  V(pavgb, 66, 0F, E0)           \
481cb0ef41Sopenharmony_ci  V(psraw, 66, 0F, E1)           \
491cb0ef41Sopenharmony_ci  V(psrad, 66, 0F, E2)           \
501cb0ef41Sopenharmony_ci  V(pavgw, 66, 0F, E3)           \
511cb0ef41Sopenharmony_ci  V(pmulhuw, 66, 0F, E4)         \
521cb0ef41Sopenharmony_ci  V(pmulhw, 66, 0F, E5)          \
531cb0ef41Sopenharmony_ci  V(psrlw, 66, 0F, D1)           \
541cb0ef41Sopenharmony_ci  V(psrld, 66, 0F, D2)           \
551cb0ef41Sopenharmony_ci  V(psrlq, 66, 0F, D3)           \
561cb0ef41Sopenharmony_ci  V(psubb, 66, 0F, F8)           \
571cb0ef41Sopenharmony_ci  V(psubw, 66, 0F, F9)           \
581cb0ef41Sopenharmony_ci  V(psubd, 66, 0F, FA)           \
591cb0ef41Sopenharmony_ci  V(psubq, 66, 0F, FB)           \
601cb0ef41Sopenharmony_ci  V(psubsb, 66, 0F, E8)          \
611cb0ef41Sopenharmony_ci  V(psubsw, 66, 0F, E9)          \
621cb0ef41Sopenharmony_ci  V(psubusb, 66, 0F, D8)         \
631cb0ef41Sopenharmony_ci  V(psubusw, 66, 0F, D9)         \
641cb0ef41Sopenharmony_ci  V(punpcklbw, 66, 0F, 60)       \
651cb0ef41Sopenharmony_ci  V(punpcklwd, 66, 0F, 61)       \
661cb0ef41Sopenharmony_ci  V(punpckldq, 66, 0F, 62)       \
671cb0ef41Sopenharmony_ci  V(punpcklqdq, 66, 0F, 6C)      \
681cb0ef41Sopenharmony_ci  V(punpckhbw, 66, 0F, 68)       \
691cb0ef41Sopenharmony_ci  V(punpckhwd, 66, 0F, 69)       \
701cb0ef41Sopenharmony_ci  V(punpckhdq, 66, 0F, 6A)       \
711cb0ef41Sopenharmony_ci  V(punpckhqdq, 66, 0F, 6D)      \
721cb0ef41Sopenharmony_ci  V(pxor, 66, 0F, EF)
731cb0ef41Sopenharmony_ci
741cb0ef41Sopenharmony_ci// Instructions dealing with scalar double-precision values.
751cb0ef41Sopenharmony_ci#define SSE2_INSTRUCTION_LIST_SD(V) \
761cb0ef41Sopenharmony_ci  V(sqrtsd, F2, 0F, 51)             \
771cb0ef41Sopenharmony_ci  V(addsd, F2, 0F, 58)              \
781cb0ef41Sopenharmony_ci  V(mulsd, F2, 0F, 59)              \
791cb0ef41Sopenharmony_ci  V(cvtsd2ss, F2, 0F, 5A)           \
801cb0ef41Sopenharmony_ci  V(subsd, F2, 0F, 5C)              \
811cb0ef41Sopenharmony_ci  V(minsd, F2, 0F, 5D)              \
821cb0ef41Sopenharmony_ci  V(divsd, F2, 0F, 5E)              \
831cb0ef41Sopenharmony_ci  V(maxsd, F2, 0F, 5F)
841cb0ef41Sopenharmony_ci
851cb0ef41Sopenharmony_ci#define SSSE3_INSTRUCTION_LIST(V) \
861cb0ef41Sopenharmony_ci  V(pshufb, 66, 0F, 38, 00)       \
871cb0ef41Sopenharmony_ci  V(phaddw, 66, 0F, 38, 01)       \
881cb0ef41Sopenharmony_ci  V(phaddd, 66, 0F, 38, 02)       \
891cb0ef41Sopenharmony_ci  V(pmaddubsw, 66, 0F, 38, 04)    \
901cb0ef41Sopenharmony_ci  V(psignb, 66, 0F, 38, 08)       \
911cb0ef41Sopenharmony_ci  V(psignw, 66, 0F, 38, 09)       \
921cb0ef41Sopenharmony_ci  V(psignd, 66, 0F, 38, 0A)       \
931cb0ef41Sopenharmony_ci  V(pmulhrsw, 66, 0F, 38, 0B)
941cb0ef41Sopenharmony_ci
951cb0ef41Sopenharmony_ci// SSSE3 instructions whose AVX version has two operands.
961cb0ef41Sopenharmony_ci#define SSSE3_UNOP_INSTRUCTION_LIST(V) \
971cb0ef41Sopenharmony_ci  V(pabsb, 66, 0F, 38, 1C)             \
981cb0ef41Sopenharmony_ci  V(pabsw, 66, 0F, 38, 1D)             \
991cb0ef41Sopenharmony_ci  V(pabsd, 66, 0F, 38, 1E)
1001cb0ef41Sopenharmony_ci
1011cb0ef41Sopenharmony_ci#define SSE4_INSTRUCTION_LIST(V) \
1021cb0ef41Sopenharmony_ci  V(pmuldq, 66, 0F, 38, 28)      \
1031cb0ef41Sopenharmony_ci  V(pcmpeqq, 66, 0F, 38, 29)     \
1041cb0ef41Sopenharmony_ci  V(packusdw, 66, 0F, 38, 2B)    \
1051cb0ef41Sopenharmony_ci  V(pminsb, 66, 0F, 38, 38)      \
1061cb0ef41Sopenharmony_ci  V(pminsd, 66, 0F, 38, 39)      \
1071cb0ef41Sopenharmony_ci  V(pminuw, 66, 0F, 38, 3A)      \
1081cb0ef41Sopenharmony_ci  V(pminud, 66, 0F, 38, 3B)      \
1091cb0ef41Sopenharmony_ci  V(pmaxsb, 66, 0F, 38, 3C)      \
1101cb0ef41Sopenharmony_ci  V(pmaxsd, 66, 0F, 38, 3D)      \
1111cb0ef41Sopenharmony_ci  V(pmaxuw, 66, 0F, 38, 3E)      \
1121cb0ef41Sopenharmony_ci  V(pmaxud, 66, 0F, 38, 3F)      \
1131cb0ef41Sopenharmony_ci  V(pmulld, 66, 0F, 38, 40)
1141cb0ef41Sopenharmony_ci
1151cb0ef41Sopenharmony_ci#define SSE4_RM_INSTRUCTION_LIST(V) \
1161cb0ef41Sopenharmony_ci  V(pmovsxbw, 66, 0F, 38, 20)       \
1171cb0ef41Sopenharmony_ci  V(pmovsxwd, 66, 0F, 38, 23)       \
1181cb0ef41Sopenharmony_ci  V(pmovsxdq, 66, 0F, 38, 25)       \
1191cb0ef41Sopenharmony_ci  V(pmovzxbw, 66, 0F, 38, 30)       \
1201cb0ef41Sopenharmony_ci  V(pmovzxwd, 66, 0F, 38, 33)       \
1211cb0ef41Sopenharmony_ci  V(pmovzxdq, 66, 0F, 38, 35)       \
1221cb0ef41Sopenharmony_ci  V(ptest, 66, 0F, 38, 17)
1231cb0ef41Sopenharmony_ci
1241cb0ef41Sopenharmony_ci// These require AVX2, and we only define the VEX-128 versions.
1251cb0ef41Sopenharmony_ci#define AVX2_BROADCAST_LIST(V)    \
1261cb0ef41Sopenharmony_ci  V(vpbroadcastd, 66, 0F, 38, 58) \
1271cb0ef41Sopenharmony_ci  V(vpbroadcastb, 66, 0F, 38, 78) \
1281cb0ef41Sopenharmony_ci  V(vpbroadcastw, 66, 0F, 38, 79)
1291cb0ef41Sopenharmony_ci
1301cb0ef41Sopenharmony_ci#endif  // V8_CODEGEN_IA32_SSE_INSTR_H_
131