Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: src/x64/assembler-x64.cc

Issue 2328843003: [x64] supplement SSE insturctions for SIMD.js (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/x64/assembler-x64.h" 5 #include "src/x64/assembler-x64.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #if V8_TARGET_ARCH_X64 9 #if V8_TARGET_ARCH_X64
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 void CpuFeatures::ProbeImpl(bool cross_compile) { 73 void CpuFeatures::ProbeImpl(bool cross_compile) {
74 base::CPU cpu; 74 base::CPU cpu;
75 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. 75 CHECK(cpu.has_sse2()); // SSE2 support is mandatory.
76 CHECK(cpu.has_cmov()); // CMOV support is mandatory. 76 CHECK(cpu.has_cmov()); // CMOV support is mandatory.
77 77
78 // Only use statically determined features for cross compile (snapshot). 78 // Only use statically determined features for cross compile (snapshot).
79 if (cross_compile) return; 79 if (cross_compile) return;
80 80
81 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; 81 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1;
82 if (cpu.has_ssse3() && FLAG_enable_ssse3) supported_ |= 1u << SSSE3;
82 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; 83 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3;
83 // SAHF is not generally available in long mode. 84 // SAHF is not generally available in long mode.
84 if (cpu.has_sahf() && FLAG_enable_sahf) supported_ |= 1u << SAHF; 85 if (cpu.has_sahf() && FLAG_enable_sahf) supported_ |= 1u << SAHF;
85 if (cpu.has_avx() && FLAG_enable_avx && cpu.has_osxsave() && 86 if (cpu.has_avx() && FLAG_enable_avx && cpu.has_osxsave() &&
86 OSHasAVXSupport()) { 87 OSHasAVXSupport()) {
87 supported_ |= 1u << AVX; 88 supported_ |= 1u << AVX;
88 } 89 }
89 if (cpu.has_fma3() && FLAG_enable_fma3 && cpu.has_osxsave() && 90 if (cpu.has_fma3() && FLAG_enable_fma3 && cpu.has_osxsave() &&
90 OSHasAVXSupport()) { 91 OSHasAVXSupport()) {
91 supported_ |= 1u << FMA3; 92 supported_ |= 1u << FMA3;
92 } 93 }
93 if (cpu.has_bmi1() && FLAG_enable_bmi1) supported_ |= 1u << BMI1; 94 if (cpu.has_bmi1() && FLAG_enable_bmi1) supported_ |= 1u << BMI1;
94 if (cpu.has_bmi2() && FLAG_enable_bmi2) supported_ |= 1u << BMI2; 95 if (cpu.has_bmi2() && FLAG_enable_bmi2) supported_ |= 1u << BMI2;
95 if (cpu.has_lzcnt() && FLAG_enable_lzcnt) supported_ |= 1u << LZCNT; 96 if (cpu.has_lzcnt() && FLAG_enable_lzcnt) supported_ |= 1u << LZCNT;
96 if (cpu.has_popcnt() && FLAG_enable_popcnt) supported_ |= 1u << POPCNT; 97 if (cpu.has_popcnt() && FLAG_enable_popcnt) supported_ |= 1u << POPCNT;
97 if (strcmp(FLAG_mcpu, "auto") == 0) { 98 if (strcmp(FLAG_mcpu, "auto") == 0) {
98 if (cpu.is_atom()) supported_ |= 1u << ATOM; 99 if (cpu.is_atom()) supported_ |= 1u << ATOM;
99 } else if (strcmp(FLAG_mcpu, "atom") == 0) { 100 } else if (strcmp(FLAG_mcpu, "atom") == 0) {
100 supported_ |= 1u << ATOM; 101 supported_ |= 1u << ATOM;
101 } 102 }
102 } 103 }
103 104
104 105
105 void CpuFeatures::PrintTarget() { } 106 void CpuFeatures::PrintTarget() { }
106 void CpuFeatures::PrintFeatures() { 107 void CpuFeatures::PrintFeatures() {
107 printf( 108 printf(
108 "SSE3=%d SSE4_1=%d SAHF=%d AVX=%d FMA3=%d BMI1=%d BMI2=%d LZCNT=%d " 109 "SSE3=%d SSSE3=%d SSE4_1=%d SAHF=%d AVX=%d FMA3=%d BMI1=%d BMI2=%d "
110 "LZCNT=%d "
109 "POPCNT=%d ATOM=%d\n", 111 "POPCNT=%d ATOM=%d\n",
110 CpuFeatures::IsSupported(SSE3), CpuFeatures::IsSupported(SSE4_1), 112 CpuFeatures::IsSupported(SSE3), CpuFeatures::IsSupported(SSSE3),
111 CpuFeatures::IsSupported(SAHF), CpuFeatures::IsSupported(AVX), 113 CpuFeatures::IsSupported(SSE4_1), CpuFeatures::IsSupported(SAHF),
112 CpuFeatures::IsSupported(FMA3), CpuFeatures::IsSupported(BMI1), 114 CpuFeatures::IsSupported(AVX), CpuFeatures::IsSupported(FMA3),
113 CpuFeatures::IsSupported(BMI2), CpuFeatures::IsSupported(LZCNT), 115 CpuFeatures::IsSupported(BMI1), CpuFeatures::IsSupported(BMI2),
114 CpuFeatures::IsSupported(POPCNT), CpuFeatures::IsSupported(ATOM)); 116 CpuFeatures::IsSupported(LZCNT), CpuFeatures::IsSupported(POPCNT),
117 CpuFeatures::IsSupported(ATOM));
115 } 118 }
116 119
117 // ----------------------------------------------------------------------------- 120 // -----------------------------------------------------------------------------
118 // Implementation of RelocInfo 121 // Implementation of RelocInfo
119 122
120 Address RelocInfo::wasm_memory_reference() { 123 Address RelocInfo::wasm_memory_reference() {
121 DCHECK(IsWasmMemoryReference(rmode_)); 124 DCHECK(IsWasmMemoryReference(rmode_));
122 return Memory::Address_at(pc_); 125 return Memory::Address_at(pc_);
123 } 126 }
124 127
(...skipping 2702 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 EnsureSpace ensure_space(this); 2830 EnsureSpace ensure_space(this);
2828 emit(0x66); 2831 emit(0x66);
2829 emit_optional_rex_32(src, dst); 2832 emit_optional_rex_32(src, dst);
2830 emit(0x0F); 2833 emit(0x0F);
2831 emit(0x3A); 2834 emit(0x3A);
2832 emit(0x17); 2835 emit(0x17);
2833 emit_sse_operand(src, dst); 2836 emit_sse_operand(src, dst);
2834 emit(imm8); 2837 emit(imm8);
2835 } 2838 }
2836 2839
2840 void Assembler::pextrb(Register dst, XMMRegister src, int8_t imm8) {
2841 DCHECK(IsEnabled(SSE4_1));
2842 DCHECK(is_uint8(imm8));
2843 EnsureSpace ensure_space(this);
2844 emit(0x66);
2845 emit_optional_rex_32(src, dst);
2846 emit(0x0F);
2847 emit(0x3A);
2848 emit(0x14);
2849 emit_sse_operand(src, dst);
2850 emit(imm8);
2851 }
2852
2853 void Assembler::pextrb(const Operand& dst, XMMRegister src, int8_t imm8) {
2854 DCHECK(IsEnabled(SSE4_1));
2855 DCHECK(is_uint8(imm8));
2856 EnsureSpace ensure_space(this);
2857 emit(0x66);
2858 emit_optional_rex_32(src, dst);
2859 emit(0x0F);
2860 emit(0x3A);
2861 emit(0x14);
2862 emit_sse_operand(src, dst);
2863 emit(imm8);
2864 }
2865
2866 void Assembler::pinsrw(XMMRegister dst, Register src, int8_t imm8) {
2867 DCHECK(is_uint8(imm8));
2868 EnsureSpace ensure_space(this);
2869 emit(0x66);
2870 emit_optional_rex_32(dst, src);
2871 emit(0x0F);
2872 emit(0xC4);
2873 emit_sse_operand(dst, src);
2874 emit(imm8);
2875 }
2876
2877 void Assembler::pinsrw(XMMRegister dst, const Operand& src, int8_t imm8) {
2878 DCHECK(is_uint8(imm8));
2879 EnsureSpace ensure_space(this);
2880 emit(0x66);
2881 emit_optional_rex_32(dst, src);
2882 emit(0x0F);
2883 emit(0xC4);
2884 emit_sse_operand(dst, src);
2885 emit(imm8);
2886 }
2887
2888 void Assembler::pextrw(Register dst, XMMRegister src, int8_t imm8) {
2889 DCHECK(is_uint8(imm8));
2890 EnsureSpace ensure_space(this);
2891 emit(0x66);
2892 emit_optional_rex_32(src, dst);
2893 emit(0x0F);
2894 emit(0xC5);
2895 emit_sse_operand(src, dst);
2896 emit(imm8);
2897 }
2898
2899 void Assembler::pextrw(const Operand& dst, XMMRegister src, int8_t imm8) {
2900 DCHECK(IsEnabled(SSE4_1));
2901 DCHECK(is_uint8(imm8));
2902 EnsureSpace ensure_space(this);
2903 emit(0x66);
2904 emit_optional_rex_32(src, dst);
2905 emit(0x0F);
2906 emit(0x3A);
2907 emit(0x15);
2908 emit_sse_operand(src, dst);
2909 emit(imm8);
2910 }
2837 2911
2838 void Assembler::pextrd(Register dst, XMMRegister src, int8_t imm8) { 2912 void Assembler::pextrd(Register dst, XMMRegister src, int8_t imm8) {
2839 DCHECK(IsEnabled(SSE4_1)); 2913 DCHECK(IsEnabled(SSE4_1));
2840 EnsureSpace ensure_space(this); 2914 EnsureSpace ensure_space(this);
2841 emit(0x66); 2915 emit(0x66);
2842 emit_optional_rex_32(src, dst); 2916 emit_optional_rex_32(src, dst);
2843 emit(0x0F); 2917 emit(0x0F);
2844 emit(0x3A); 2918 emit(0x3A);
2845 emit(0x16); 2919 emit(0x16);
2846 emit_sse_operand(src, dst); 2920 emit_sse_operand(src, dst);
2847 emit(imm8); 2921 emit(imm8);
2848 } 2922 }
2849 2923
2924 void Assembler::pextrd(const Operand& dst, XMMRegister src, int8_t imm8) {
2925 DCHECK(IsEnabled(SSE4_1));
2926 EnsureSpace ensure_space(this);
2927 emit(0x66);
2928 emit_optional_rex_32(src, dst);
2929 emit(0x0F);
2930 emit(0x3A);
2931 emit(0x16);
2932 emit_sse_operand(src, dst);
2933 emit(imm8);
2934 }
2850 2935
2851 void Assembler::pinsrd(XMMRegister dst, Register src, int8_t imm8) { 2936 void Assembler::pinsrd(XMMRegister dst, Register src, int8_t imm8) {
2852 DCHECK(IsEnabled(SSE4_1)); 2937 DCHECK(IsEnabled(SSE4_1));
2853 EnsureSpace ensure_space(this); 2938 EnsureSpace ensure_space(this);
2854 emit(0x66); 2939 emit(0x66);
2855 emit_optional_rex_32(dst, src); 2940 emit_optional_rex_32(dst, src);
2856 emit(0x0F); 2941 emit(0x0F);
2857 emit(0x3A); 2942 emit(0x3A);
2858 emit(0x22); 2943 emit(0x22);
2859 emit_sse_operand(dst, src); 2944 emit_sse_operand(dst, src);
2860 emit(imm8); 2945 emit(imm8);
2861 } 2946 }
2862 2947
2863 2948
2864 void Assembler::pinsrd(XMMRegister dst, const Operand& src, int8_t imm8) { 2949 void Assembler::pinsrd(XMMRegister dst, const Operand& src, int8_t imm8) {
2865 DCHECK(IsEnabled(SSE4_1)); 2950 DCHECK(IsEnabled(SSE4_1));
2866 EnsureSpace ensure_space(this); 2951 EnsureSpace ensure_space(this);
2867 emit(0x66); 2952 emit(0x66);
2868 emit_optional_rex_32(dst, src); 2953 emit_optional_rex_32(dst, src);
2869 emit(0x0F); 2954 emit(0x0F);
2870 emit(0x3A); 2955 emit(0x3A);
2871 emit(0x22); 2956 emit(0x22);
2872 emit_sse_operand(dst, src); 2957 emit_sse_operand(dst, src);
2873 emit(imm8); 2958 emit(imm8);
2874 } 2959 }
2875 2960
2961 void Assembler::pinsrb(XMMRegister dst, Register src, int8_t imm8) {
2962 DCHECK(IsEnabled(SSE4_1));
2963 EnsureSpace ensure_space(this);
2964 emit(0x66);
2965 emit_optional_rex_32(dst, src);
2966 emit(0x0F);
2967 emit(0x3A);
2968 emit(0x20);
2969 emit_sse_operand(dst, src);
2970 emit(imm8);
2971 }
2972
2973 void Assembler::pinsrb(XMMRegister dst, const Operand& src, int8_t imm8) {
2974 DCHECK(IsEnabled(SSE4_1));
2975 EnsureSpace ensure_space(this);
2976 emit(0x66);
2977 emit_optional_rex_32(dst, src);
2978 emit(0x0F);
2979 emit(0x3A);
2980 emit(0x20);
2981 emit_sse_operand(dst, src);
2982 emit(imm8);
2983 }
2984
2876 void Assembler::insertps(XMMRegister dst, XMMRegister src, byte imm8) { 2985 void Assembler::insertps(XMMRegister dst, XMMRegister src, byte imm8) {
2877 DCHECK(CpuFeatures::IsSupported(SSE4_1)); 2986 DCHECK(CpuFeatures::IsSupported(SSE4_1));
2878 DCHECK(is_uint8(imm8)); 2987 DCHECK(is_uint8(imm8));
2879 EnsureSpace ensure_space(this); 2988 EnsureSpace ensure_space(this);
2880 emit(0x66); 2989 emit(0x66);
2881 emit_optional_rex_32(dst, src); 2990 emit_optional_rex_32(dst, src);
2882 emit(0x0F); 2991 emit(0x0F);
2883 emit(0x3A); 2992 emit(0x3A);
2884 emit(0x21); 2993 emit(0x21);
2885 emit_sse_operand(dst, src); 2994 emit_sse_operand(dst, src);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 DCHECK(!IsEnabled(AVX)); 3304 DCHECK(!IsEnabled(AVX));
3196 EnsureSpace ensure_space(this); 3305 EnsureSpace ensure_space(this);
3197 emit(0x66); 3306 emit(0x66);
3198 emit_optional_rex_32(reg); 3307 emit_optional_rex_32(reg);
3199 emit(0x0F); 3308 emit(0x0F);
3200 emit(0x73); 3309 emit(0x73);
3201 emit_sse_operand(rdx, reg); // rdx == 2 3310 emit_sse_operand(rdx, reg); // rdx == 2
3202 emit(imm8); 3311 emit(imm8);
3203 } 3312 }
3204 3313
3314 void Assembler::psllw(XMMRegister reg, byte imm8) {
3315 EnsureSpace ensure_space(this);
3316 emit(0x66);
3317 emit_optional_rex_32(reg);
3318 emit(0x0F);
3319 emit(0x71);
3320 emit_sse_operand(rsi, reg); // rsi == 6
3321 emit(imm8);
3322 }
3205 3323
3206 void Assembler::pslld(XMMRegister reg, byte imm8) { 3324 void Assembler::pslld(XMMRegister reg, byte imm8) {
3207 EnsureSpace ensure_space(this); 3325 EnsureSpace ensure_space(this);
3208 emit(0x66); 3326 emit(0x66);
3209 emit_optional_rex_32(reg); 3327 emit_optional_rex_32(reg);
3210 emit(0x0F); 3328 emit(0x0F);
3211 emit(0x72); 3329 emit(0x72);
3212 emit_sse_operand(rsi, reg); // rsi == 6 3330 emit_sse_operand(rsi, reg); // rsi == 6
3213 emit(imm8); 3331 emit(imm8);
3214 } 3332 }
3215 3333
3334 void Assembler::psrlw(XMMRegister reg, byte imm8) {
3335 EnsureSpace ensure_space(this);
3336 emit(0x66);
3337 emit_optional_rex_32(reg);
3338 emit(0x0F);
3339 emit(0x71);
3340 emit_sse_operand(rdx, reg); // rdx == 2
3341 emit(imm8);
3342 }
3216 3343
3217 void Assembler::psrld(XMMRegister reg, byte imm8) { 3344 void Assembler::psrld(XMMRegister reg, byte imm8) {
3218 EnsureSpace ensure_space(this); 3345 EnsureSpace ensure_space(this);
3219 emit(0x66); 3346 emit(0x66);
3220 emit_optional_rex_32(reg); 3347 emit_optional_rex_32(reg);
3221 emit(0x0F); 3348 emit(0x0F);
3222 emit(0x72); 3349 emit(0x72);
3223 emit_sse_operand(rdx, reg); // rdx == 2 3350 emit_sse_operand(rdx, reg); // rdx == 2
3224 emit(imm8); 3351 emit(imm8);
3225 } 3352 }
3226 3353
3354 void Assembler::psraw(XMMRegister reg, byte imm8) {
3355 EnsureSpace ensure_space(this);
3356 emit(0x66);
3357 emit_optional_rex_32(reg);
3358 emit(0x0F);
3359 emit(0x71);
3360 emit_sse_operand(rsp, reg); // rsp == 4
3361 emit(imm8);
3362 }
3363
3364 void Assembler::psrad(XMMRegister reg, byte imm8) {
3365 EnsureSpace ensure_space(this);
3366 emit(0x66);
3367 emit_optional_rex_32(reg);
3368 emit(0x0F);
3369 emit(0x72);
3370 emit_sse_operand(rsp, reg); // rsp == 4
3371 emit(imm8);
3372 }
3373
3227 void Assembler::cmpps(XMMRegister dst, XMMRegister src, int8_t cmp) { 3374 void Assembler::cmpps(XMMRegister dst, XMMRegister src, int8_t cmp) {
3228 EnsureSpace ensure_space(this); 3375 EnsureSpace ensure_space(this);
3229 emit_optional_rex_32(dst, src); 3376 emit_optional_rex_32(dst, src);
3230 emit(0x0F); 3377 emit(0x0F);
3231 emit(0xC2); 3378 emit(0xC2);
3232 emit_sse_operand(dst, src); 3379 emit_sse_operand(dst, src);
3233 emit(cmp); 3380 emit(cmp);
3234 } 3381 }
3235 3382
3236 void Assembler::cmpps(XMMRegister dst, const Operand& src, int8_t cmp) { 3383 void Assembler::cmpps(XMMRegister dst, const Operand& src, int8_t cmp) {
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
3782 3929
3783 void Assembler::movmskps(Register dst, XMMRegister src) { 3930 void Assembler::movmskps(Register dst, XMMRegister src) {
3784 EnsureSpace ensure_space(this); 3931 EnsureSpace ensure_space(this);
3785 emit_optional_rex_32(dst, src); 3932 emit_optional_rex_32(dst, src);
3786 emit(0x0f); 3933 emit(0x0f);
3787 emit(0x50); 3934 emit(0x50);
3788 emit_sse_operand(dst, src); 3935 emit_sse_operand(dst, src);
3789 } 3936 }
3790 3937
3791 3938
3792 void Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) {
3793 DCHECK(!IsEnabled(AVX));
3794 EnsureSpace ensure_space(this);
3795 emit(0x66);
3796 emit_optional_rex_32(dst, src);
3797 emit(0x0F);
3798 emit(0x76);
3799 emit_sse_operand(dst, src);
3800 }
3801
3802
3803 void Assembler::punpckldq(XMMRegister dst, XMMRegister src) { 3939 void Assembler::punpckldq(XMMRegister dst, XMMRegister src) {
3804 EnsureSpace ensure_space(this); 3940 EnsureSpace ensure_space(this);
3805 emit(0x66); 3941 emit(0x66);
3806 emit_optional_rex_32(dst, src); 3942 emit_optional_rex_32(dst, src);
3807 emit(0x0F); 3943 emit(0x0F);
3808 emit(0x62); 3944 emit(0x62);
3809 emit_sse_operand(dst, src); 3945 emit_sse_operand(dst, src);
3810 } 3946 }
3811 3947
3812 void Assembler::punpckldq(XMMRegister dst, const Operand& src) { 3948 void Assembler::punpckldq(XMMRegister dst, const Operand& src) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3919 4055
3920 void Assembler::vmovq(Register dst, XMMRegister src) { 4056 void Assembler::vmovq(Register dst, XMMRegister src) {
3921 DCHECK(IsEnabled(AVX)); 4057 DCHECK(IsEnabled(AVX));
3922 EnsureSpace ensure_space(this); 4058 EnsureSpace ensure_space(this);
3923 XMMRegister idst = {dst.code()}; 4059 XMMRegister idst = {dst.code()};
3924 emit_vex_prefix(src, xmm0, idst, kL128, k66, k0F, kW1); 4060 emit_vex_prefix(src, xmm0, idst, kL128, k66, k0F, kW1);
3925 emit(0x7e); 4061 emit(0x7e);
3926 emit_sse_operand(src, dst); 4062 emit_sse_operand(src, dst);
3927 } 4063 }
3928 4064
3929 4065 void Assembler::vinstr(byte op, XMMRegister dst, XMMRegister src1,
3930 void Assembler::vsd(byte op, XMMRegister dst, XMMRegister src1, 4066 XMMRegister src2, SIMDPrefix pp, LeadingOpcode m,
3931 XMMRegister src2, SIMDPrefix pp, LeadingOpcode m, VexW w) { 4067 VexW w) {
3932 DCHECK(IsEnabled(AVX)); 4068 DCHECK(IsEnabled(AVX));
3933 EnsureSpace ensure_space(this); 4069 EnsureSpace ensure_space(this);
3934 emit_vex_prefix(dst, src1, src2, kLIG, pp, m, w); 4070 emit_vex_prefix(dst, src1, src2, kLIG, pp, m, w);
3935 emit(op); 4071 emit(op);
3936 emit_sse_operand(dst, src2); 4072 emit_sse_operand(dst, src2);
3937 } 4073 }
3938 4074
3939 4075 void Assembler::vinstr(byte op, XMMRegister dst, XMMRegister src1,
3940 void Assembler::vsd(byte op, XMMRegister dst, XMMRegister src1, 4076 const Operand& src2, SIMDPrefix pp, LeadingOpcode m,
3941 const Operand& src2, SIMDPrefix pp, LeadingOpcode m, 4077 VexW w) {
3942 VexW w) {
3943 DCHECK(IsEnabled(AVX)); 4078 DCHECK(IsEnabled(AVX));
3944 EnsureSpace ensure_space(this); 4079 EnsureSpace ensure_space(this);
3945 emit_vex_prefix(dst, src1, src2, kLIG, pp, m, w); 4080 emit_vex_prefix(dst, src1, src2, kLIG, pp, m, w);
3946 emit(op); 4081 emit(op);
3947 emit_sse_operand(dst, src2); 4082 emit_sse_operand(dst, src2);
3948 } 4083 }
3949 4084
3950 4085
3951 void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, 4086 void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1,
3952 XMMRegister src2) { 4087 XMMRegister src2) {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
4402 } 4537 }
4403 4538
4404 void Assembler::movups(const Operand& dst, XMMRegister src) { 4539 void Assembler::movups(const Operand& dst, XMMRegister src) {
4405 EnsureSpace ensure_space(this); 4540 EnsureSpace ensure_space(this);
4406 emit_optional_rex_32(src, dst); 4541 emit_optional_rex_32(src, dst);
4407 emit(0x0F); 4542 emit(0x0F);
4408 emit(0x11); 4543 emit(0x11);
4409 emit_sse_operand(src, dst); 4544 emit_sse_operand(src, dst);
4410 } 4545 }
4411 4546
4412 void Assembler::paddd(XMMRegister dst, XMMRegister src) { 4547 void Assembler::sse2_instr(XMMRegister dst, XMMRegister src, byte prefix,
4548 byte escape, byte opcode) {
4413 EnsureSpace ensure_space(this); 4549 EnsureSpace ensure_space(this);
4414 emit(0x66); 4550 emit(prefix);
4415 emit_optional_rex_32(dst, src); 4551 emit_optional_rex_32(dst, src);
4416 emit(0x0F); 4552 emit(escape);
4417 emit(0xFE); 4553 emit(opcode);
4418 emit_sse_operand(dst, src); 4554 emit_sse_operand(dst, src);
4419 } 4555 }
4420 4556
4421 void Assembler::paddd(XMMRegister dst, const Operand& src) { 4557 void Assembler::sse2_instr(XMMRegister dst, const Operand& src, byte prefix,
4558 byte escape, byte opcode) {
4422 EnsureSpace ensure_space(this); 4559 EnsureSpace ensure_space(this);
4423 emit(0x66); 4560 emit(prefix);
4424 emit_optional_rex_32(dst, src); 4561 emit_optional_rex_32(dst, src);
4425 emit(0x0F); 4562 emit(escape);
4426 emit(0xFE); 4563 emit(opcode);
4427 emit_sse_operand(dst, src); 4564 emit_sse_operand(dst, src);
4428 } 4565 }
4429 4566
4430 void Assembler::psubd(XMMRegister dst, XMMRegister src) { 4567 void Assembler::ssse3_instr(XMMRegister dst, XMMRegister src, byte prefix,
4568 byte escape1, byte escape2, byte opcode) {
4569 DCHECK(IsEnabled(SSSE3));
4431 EnsureSpace ensure_space(this); 4570 EnsureSpace ensure_space(this);
4432 emit(0x66); 4571 emit(prefix);
4433 emit_optional_rex_32(dst, src); 4572 emit_optional_rex_32(dst, src);
4434 emit(0x0F); 4573 emit(escape1);
4435 emit(0xFA); 4574 emit(escape2);
4575 emit(opcode);
4436 emit_sse_operand(dst, src); 4576 emit_sse_operand(dst, src);
4437 } 4577 }
4438 4578
4439 void Assembler::psubd(XMMRegister dst, const Operand& src) { 4579 void Assembler::ssse3_instr(XMMRegister dst, const Operand& src, byte prefix,
4580 byte escape1, byte escape2, byte opcode) {
4581 DCHECK(IsEnabled(SSSE3));
4440 EnsureSpace ensure_space(this); 4582 EnsureSpace ensure_space(this);
4441 emit(0x66); 4583 emit(prefix);
4442 emit_optional_rex_32(dst, src); 4584 emit_optional_rex_32(dst, src);
4443 emit(0x0F); 4585 emit(escape1);
4444 emit(0xFA); 4586 emit(escape2);
4587 emit(opcode);
4445 emit_sse_operand(dst, src); 4588 emit_sse_operand(dst, src);
4446 } 4589 }
4447 4590
4448 void Assembler::pmulld(XMMRegister dst, XMMRegister src) { 4591 void Assembler::sse4_instr(XMMRegister dst, XMMRegister src, byte prefix,
4592 byte escape1, byte escape2, byte opcode) {
4449 DCHECK(IsEnabled(SSE4_1)); 4593 DCHECK(IsEnabled(SSE4_1));
4450 EnsureSpace ensure_space(this); 4594 EnsureSpace ensure_space(this);
4451 emit(0x66); 4595 emit(prefix);
4452 emit_optional_rex_32(dst, src); 4596 emit_optional_rex_32(dst, src);
4453 emit(0x0F); 4597 emit(escape1);
4454 emit(0x38); 4598 emit(escape2);
4455 emit(0x40); 4599 emit(opcode);
4456 emit_sse_operand(dst, src); 4600 emit_sse_operand(dst, src);
4457 } 4601 }
4458 4602
4459 void Assembler::pmulld(XMMRegister dst, const Operand& src) { 4603 void Assembler::sse4_instr(XMMRegister dst, const Operand& src, byte prefix,
4604 byte escape1, byte escape2, byte opcode) {
4605 DCHECK(IsEnabled(SSE4_1));
4460 EnsureSpace ensure_space(this); 4606 EnsureSpace ensure_space(this);
4461 emit(0x66); 4607 emit(prefix);
4462 emit_optional_rex_32(dst, src); 4608 emit_optional_rex_32(dst, src);
4463 emit(0x0F); 4609 emit(escape1);
4464 emit(0x38); 4610 emit(escape2);
4465 emit(0x40); 4611 emit(opcode);
4466 emit_sse_operand(dst, src); 4612 emit_sse_operand(dst, src);
4467 } 4613 }
4468 4614
4469 void Assembler::pmuludq(XMMRegister dst, XMMRegister src) { 4615 void Assembler::lddqu(XMMRegister dst, const Operand& src) {
4616 DCHECK(IsEnabled(SSE3));
4470 EnsureSpace ensure_space(this); 4617 EnsureSpace ensure_space(this);
4471 emit(0x66); 4618 emit(0xF2);
4472 emit_optional_rex_32(dst, src); 4619 emit_optional_rex_32(dst, src);
4473 emit(0x0F); 4620 emit(0x0F);
4474 emit(0xF4); 4621 emit(0xF0);
4475 emit_sse_operand(dst, src); 4622 emit_sse_operand(dst, src);
4476 } 4623 }
4477 4624
4478 void Assembler::pmuludq(XMMRegister dst, const Operand& src) {
4479 EnsureSpace ensure_space(this);
4480 emit(0x66);
4481 emit_optional_rex_32(dst, src);
4482 emit(0x0F);
4483 emit(0xF4);
4484 emit_sse_operand(dst, src);
4485 }
4486
4487 void Assembler::psrldq(XMMRegister dst, uint8_t shift) { 4625 void Assembler::psrldq(XMMRegister dst, uint8_t shift) {
4488 EnsureSpace ensure_space(this); 4626 EnsureSpace ensure_space(this);
4489 emit(0x66); 4627 emit(0x66);
4490 emit_optional_rex_32(dst); 4628 emit_optional_rex_32(dst);
4491 emit(0x0F); 4629 emit(0x0F);
4492 emit(0x73); 4630 emit(0x73);
4493 emit_sse_operand(dst); 4631 emit_sse_operand(dst);
4494 emit(shift); 4632 emit(shift);
4495 } 4633 }
4496 4634
4497 void Assembler::cvtps2dq(XMMRegister dst, XMMRegister src) {
4498 EnsureSpace ensure_space(this);
4499 emit(0x66);
4500 emit_optional_rex_32(dst, src);
4501 emit(0x0F);
4502 emit(0x5B);
4503 emit_sse_operand(dst, src);
4504 }
4505
4506 void Assembler::cvtps2dq(XMMRegister dst, const Operand& src) {
4507 EnsureSpace ensure_space(this);
4508 emit(0x66);
4509 emit_optional_rex_32(dst, src);
4510 emit(0x0F);
4511 emit(0x5B);
4512 emit_sse_operand(dst, src);
4513 }
4514
4515 void Assembler::pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle) { 4635 void Assembler::pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
4516 EnsureSpace ensure_space(this); 4636 EnsureSpace ensure_space(this);
4517 emit(0x66); 4637 emit(0x66);
4518 emit_optional_rex_32(dst, src); 4638 emit_optional_rex_32(dst, src);
4639 emit(0x0F);
4640 emit(0x70);
4641 emit_sse_operand(dst, src);
4642 emit(shuffle);
4643 }
4644
4645 void Assembler::pshufd(XMMRegister dst, const Operand& src, uint8_t shuffle) {
4646 EnsureSpace ensure_space(this);
4647 emit(0x66);
4648 emit_optional_rex_32(dst, src);
4519 emit(0x0F); 4649 emit(0x0F);
4520 emit(0x70); 4650 emit(0x70);
4521 emit_sse_operand(dst, src); 4651 emit_sse_operand(dst, src);
4522 emit(shuffle); 4652 emit(shuffle);
4523 } 4653 }
4524 4654
4525 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { 4655 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) {
4526 Register ireg = { reg.code() }; 4656 Register ireg = { reg.code() };
4527 emit_operand(ireg, adr); 4657 emit_operand(ireg, adr);
4528 } 4658 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
4625 4755
4626 bool RelocInfo::IsInConstantPool() { 4756 bool RelocInfo::IsInConstantPool() {
4627 return false; 4757 return false;
4628 } 4758 }
4629 4759
4630 4760
4631 } // namespace internal 4761 } // namespace internal
4632 } // namespace v8 4762 } // namespace v8
4633 4763
4634 #endif // V8_TARGET_ARCH_X64 4764 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698