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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 197233011: Add a utility method to the ia32 macro assembler to move a double immediate into an XMM register. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | test/cctest/test-macro-assembler-ia32.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 } 2840 }
2841 2841
2842 2842
2843 void MacroAssembler::Move(Register dst, Register src) { 2843 void MacroAssembler::Move(Register dst, Register src) {
2844 if (!dst.is(src)) { 2844 if (!dst.is(src)) {
2845 mov(dst, src); 2845 mov(dst, src);
2846 } 2846 }
2847 } 2847 }
2848 2848
2849 2849
2850 void MacroAssembler::Move(Register dst, Immediate imm) { 2850 void MacroAssembler::Move(Register dst, Immediate imm) {
Michael Starzinger 2014/03/21 10:44:55 As discussed offline: This method is a duplication
2851 if (imm.is_zero()) { 2851 if (imm.is_zero()) {
2852 xor_(dst, dst); 2852 xor_(dst, dst);
2853 } else { 2853 } else {
2854 mov(dst, imm); 2854 mov(dst, imm);
2855 } 2855 }
2856 } 2856 }
2857 2857
2858 2858
2859 void MacroAssembler::Move(XMMRegister dst, double val) {
2860 // TODO(titzer): recognize double constants with ExternalReferences.
2861 CpuFeatureScope scope(this, SSE2);
2862 uint64_t int_val = BitCast<uint64_t, double>(val);
2863 if (int_val == 0) {
2864 xorps(dst, dst);
2865 } else {
2866 int32_t lower = static_cast<int32_t>(int_val);
2867 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt);
2868 push(Immediate(upper));
2869 push(Immediate(lower));
2870 movsd(dst, Operand(esp, 0));
2871 add(esp, Immediate(kDoubleSize));
2872 }
2873 }
2874
2875
2859 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { 2876 void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
2860 if (FLAG_native_code_counters && counter->Enabled()) { 2877 if (FLAG_native_code_counters && counter->Enabled()) {
2861 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); 2878 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));
2862 } 2879 }
2863 } 2880 }
2864 2881
2865 2882
2866 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { 2883 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) {
2867 ASSERT(value > 0); 2884 ASSERT(value > 0);
2868 if (FLAG_native_code_counters && counter->Enabled()) { 2885 if (FLAG_native_code_counters && counter->Enabled()) {
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 if (ms.shift() > 0) sar(edx, ms.shift()); 3655 if (ms.shift() > 0) sar(edx, ms.shift());
3639 mov(eax, dividend); 3656 mov(eax, dividend);
3640 shr(eax, 31); 3657 shr(eax, 31);
3641 add(edx, eax); 3658 add(edx, eax);
3642 } 3659 }
3643 3660
3644 3661
3645 } } // namespace v8::internal 3662 } } // namespace v8::internal
3646 3663
3647 #endif // V8_TARGET_ARCH_IA32 3664 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | test/cctest/test-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698