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

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

Issue 2771513002: Add pshufw instruction, fix inconsistencies with pextrw instruction. (Closed)
Patch Set: Created 3 years, 9 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 827
828 828
829 void Assembler::bsfq(Register dst, const Operand& src) { 829 void Assembler::bsfq(Register dst, const Operand& src) {
830 EnsureSpace ensure_space(this); 830 EnsureSpace ensure_space(this);
831 emit_rex_64(dst, src); 831 emit_rex_64(dst, src);
832 emit(0x0F); 832 emit(0x0F);
833 emit(0xBC); 833 emit(0xBC);
834 emit_operand(dst, src); 834 emit_operand(dst, src);
835 } 835 }
836 836
837 void Assembler::pshufw(XMMRegister dst, XMMRegister src, uint8_t shuffle) {
838 EnsureSpace ensure_space(this);
839 emit_optional_rex_32(dst, src);
840 emit(0x0F);
841 emit(0x70);
842 emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
843 emit(shuffle);
844 }
845
846 void Assembler::pshufw(XMMRegister dst, const Operand& src, uint8_t shuffle) {
847 EnsureSpace ensure_space(this);
848 emit_optional_rex_32(dst, src);
849 emit(0x0F);
850 emit(0x70);
851 emit_operand(dst.code(), src);
852 emit(shuffle);
853 }
837 854
838 void Assembler::call(Label* L) { 855 void Assembler::call(Label* L) {
839 EnsureSpace ensure_space(this); 856 EnsureSpace ensure_space(this);
840 // 1110 1000 #32-bit disp. 857 // 1110 1000 #32-bit disp.
841 emit(0xE8); 858 emit(0xE8);
842 if (L->is_bound()) { 859 if (L->is_bound()) {
843 int offset = L->pos() - pc_offset() - sizeof(int32_t); 860 int offset = L->pos() - pc_offset() - sizeof(int32_t);
844 DCHECK(offset <= 0); 861 DCHECK(offset <= 0);
845 emitl(offset); 862 emitl(offset);
846 } else if (L->is_linked()) { 863 } else if (L->is_linked()) {
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2864 EnsureSpace ensure_space(this); 2881 EnsureSpace ensure_space(this);
2865 emit(0x66); 2882 emit(0x66);
2866 emit_optional_rex_32(dst, src); 2883 emit_optional_rex_32(dst, src);
2867 emit(0x0F); 2884 emit(0x0F);
2868 emit(0xC4); 2885 emit(0xC4);
2869 emit_sse_operand(dst, src); 2886 emit_sse_operand(dst, src);
2870 emit(imm8); 2887 emit(imm8);
2871 } 2888 }
2872 2889
2873 void Assembler::pextrw(Register dst, XMMRegister src, int8_t imm8) { 2890 void Assembler::pextrw(Register dst, XMMRegister src, int8_t imm8) {
2891 DCHECK(IsEnabled(SSE4_1));
2874 DCHECK(is_uint8(imm8)); 2892 DCHECK(is_uint8(imm8));
bbudge 2017/03/22 19:17:05 If I'm reading the docs correctly, this could be e
gdeepti 2017/03/22 20:45:34 A agree that this check could be stronger, but I'm
bbudge 2017/03/22 21:09:40 OK
2875 EnsureSpace ensure_space(this); 2893 EnsureSpace ensure_space(this);
2876 emit(0x66); 2894 emit(0x66);
2877 emit_optional_rex_32(src, dst); 2895 emit_optional_rex_32(dst, src);
2878 emit(0x0F); 2896 emit(0x0F);
2879 emit(0xC5); 2897 emit(0x3A);
2880 emit_sse_operand(src, dst); 2898 emit(0x15);
2899 emit_sse_operand(dst, src);
2881 emit(imm8); 2900 emit(imm8);
2882 } 2901 }
2883 2902
2884 void Assembler::pextrw(const Operand& dst, XMMRegister src, int8_t imm8) { 2903 void Assembler::pextrw(const Operand& dst, XMMRegister src, int8_t imm8) {
2885 DCHECK(IsEnabled(SSE4_1)); 2904 DCHECK(IsEnabled(SSE4_1));
2886 DCHECK(is_uint8(imm8)); 2905 DCHECK(is_uint8(imm8));
2887 EnsureSpace ensure_space(this); 2906 EnsureSpace ensure_space(this);
2888 emit(0x66); 2907 emit(0x66);
2889 emit_optional_rex_32(src, dst); 2908 emit_optional_rex_32(src, dst);
2890 emit(0x0F); 2909 emit(0x0F);
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after
4747 4766
4748 bool RelocInfo::IsInConstantPool() { 4767 bool RelocInfo::IsInConstantPool() {
4749 return false; 4768 return false;
4750 } 4769 }
4751 4770
4752 4771
4753 } // namespace internal 4772 } // namespace internal
4754 } // namespace v8 4773 } // namespace v8
4755 4774
4756 #endif // V8_TARGET_ARCH_X64 4775 #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