Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include <stdlib.h> |
| 29 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 30 | #include "src/v8.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 31 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame] | 32 | #include "src/code-factory.h" |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 33 | #include "src/debug/debug.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 34 | #include "src/disasm.h" |
| 35 | #include "src/disassembler.h" |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 36 | #include "src/ia32/frames-ia32.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 37 | #include "src/macro-assembler.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 38 | #include "test/cctest/cctest.h" |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 39 | |
| 40 | using namespace v8::internal; |
| 41 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 42 | |
| 43 | #define __ assm. |
| 44 | |
| 45 | |
| 46 | static void DummyStaticFunction(Object* result) { |
| 47 | } |
| 48 | |
| 49 | |
| 50 | TEST(DisasmIa320) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 51 | CcTest::InitializeVM(); |
| 52 | Isolate* isolate = CcTest::i_isolate(); |
| 53 | HandleScope scope(isolate); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 54 | v8::internal::byte buffer[4096]; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 55 | Assembler assm(isolate, buffer, sizeof buffer); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 56 | DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) |
| 57 | |
| 58 | // Short immediate instructions |
| 59 | __ adc(eax, 12345678); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 60 | __ add(eax, Immediate(12345678)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 61 | __ or_(eax, 12345678); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 62 | __ sub(eax, Immediate(12345678)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 63 | __ xor_(eax, 12345678); |
| 64 | __ and_(eax, 12345678); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 65 | Handle<FixedArray> foo = isolate->factory()->NewFixedArray(10, TENURED); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 66 | __ cmp(eax, foo); |
| 67 | |
| 68 | // ---- This one caused crash |
| 69 | __ mov(ebx, Operand(esp, ecx, times_2, 0)); // [esp+ecx*4] |
| 70 | |
| 71 | // ---- All instructions that I can think of |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 72 | __ add(edx, ebx); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 73 | __ add(edx, Operand(12, RelocInfo::NONE32)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 74 | __ add(edx, Operand(ebx, 0)); |
| 75 | __ add(edx, Operand(ebx, 16)); |
| 76 | __ add(edx, Operand(ebx, 1999)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 77 | __ add(edx, Operand(ebx, -4)); |
| 78 | __ add(edx, Operand(ebx, -1999)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 79 | __ add(edx, Operand(esp, 0)); |
| 80 | __ add(edx, Operand(esp, 16)); |
| 81 | __ add(edx, Operand(esp, 1999)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 82 | __ add(edx, Operand(esp, -4)); |
| 83 | __ add(edx, Operand(esp, -1999)); |
| 84 | __ nop(); |
| 85 | __ add(esi, Operand(ecx, times_4, 0)); |
| 86 | __ add(esi, Operand(ecx, times_4, 24)); |
| 87 | __ add(esi, Operand(ecx, times_4, -4)); |
| 88 | __ add(esi, Operand(ecx, times_4, -1999)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 89 | __ nop(); |
| 90 | __ add(edi, Operand(ebp, ecx, times_4, 0)); |
| 91 | __ add(edi, Operand(ebp, ecx, times_4, 12)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 92 | __ add(edi, Operand(ebp, ecx, times_4, -8)); |
| 93 | __ add(edi, Operand(ebp, ecx, times_4, -3999)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 94 | __ add(Operand(ebp, ecx, times_4, 12), Immediate(12)); |
| 95 | |
| 96 | __ nop(); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 97 | __ add(ebx, Immediate(12)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 98 | __ nop(); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 99 | __ adc(edx, Operand(ebx)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 100 | __ adc(ecx, 12); |
| 101 | __ adc(ecx, 1000); |
| 102 | __ nop(); |
| 103 | __ and_(edx, 3); |
| 104 | __ and_(edx, Operand(esp, 4)); |
| 105 | __ cmp(edx, 3); |
| 106 | __ cmp(edx, Operand(esp, 4)); |
| 107 | __ cmp(Operand(ebp, ecx, times_4, 0), Immediate(1000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 108 | Handle<FixedArray> foo2 = isolate->factory()->NewFixedArray(10, TENURED); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 109 | __ cmp(ebx, foo2); |
Leon Clarke | d91b9f7 | 2010-01-27 17:25:45 +0000 | [diff] [blame] | 110 | __ cmpb(ebx, Operand(ebp, ecx, times_2, 0)); |
| 111 | __ cmpb(Operand(ebp, ecx, times_2, 0), ebx); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 112 | __ or_(edx, 3); |
| 113 | __ xor_(edx, 3); |
| 114 | __ nop(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 115 | __ cpuid(); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 116 | __ movsx_b(edx, ecx); |
| 117 | __ movsx_w(edx, ecx); |
| 118 | __ movzx_b(edx, ecx); |
| 119 | __ movzx_w(edx, ecx); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 120 | |
| 121 | __ nop(); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 122 | __ imul(edx, ecx); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 123 | __ shld(edx, ecx, 10); |
| 124 | __ shld_cl(edx, ecx); |
| 125 | __ shrd(edx, ecx, 10); |
| 126 | __ shrd_cl(edx, ecx); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 127 | __ bts(edx, ecx); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 128 | __ bts(Operand(ebx, ecx, times_4, 0), ecx); |
| 129 | __ nop(); |
| 130 | __ pushad(); |
| 131 | __ popad(); |
| 132 | __ pushfd(); |
| 133 | __ popfd(); |
| 134 | __ push(Immediate(12)); |
| 135 | __ push(Immediate(23456)); |
| 136 | __ push(ecx); |
| 137 | __ push(esi); |
| 138 | __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 139 | __ push(Operand(ebx, ecx, times_4, 0)); |
| 140 | __ push(Operand(ebx, ecx, times_4, 0)); |
| 141 | __ push(Operand(ebx, ecx, times_4, 10000)); |
| 142 | __ pop(edx); |
| 143 | __ pop(eax); |
| 144 | __ pop(Operand(ebx, ecx, times_4, 0)); |
| 145 | __ nop(); |
| 146 | |
| 147 | __ add(edx, Operand(esp, 16)); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 148 | __ add(edx, ecx); |
| 149 | __ mov_b(edx, ecx); |
| 150 | __ mov_b(ecx, 6); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 151 | __ mov_b(Operand(ebx, ecx, times_4, 10000), 6); |
| 152 | __ mov_b(Operand(esp, 16), edx); |
| 153 | __ mov_w(edx, Operand(esp, 16)); |
| 154 | __ mov_w(Operand(esp, 16), edx); |
| 155 | __ nop(); |
| 156 | __ movsx_w(edx, Operand(esp, 12)); |
| 157 | __ movsx_b(edx, Operand(esp, 12)); |
| 158 | __ movzx_w(edx, Operand(esp, 12)); |
| 159 | __ movzx_b(edx, Operand(esp, 12)); |
| 160 | __ nop(); |
| 161 | __ mov(edx, 1234567); |
| 162 | __ mov(edx, Operand(esp, 12)); |
| 163 | __ mov(Operand(ebx, ecx, times_4, 10000), Immediate(12345)); |
| 164 | __ mov(Operand(ebx, ecx, times_4, 10000), edx); |
| 165 | __ nop(); |
| 166 | __ dec_b(edx); |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 167 | __ dec_b(Operand(eax, 10)); |
| 168 | __ dec_b(Operand(ebx, ecx, times_4, 10000)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 169 | __ dec(edx); |
| 170 | __ cdq(); |
| 171 | |
| 172 | __ nop(); |
| 173 | __ idiv(edx); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 174 | __ idiv(Operand(edx, ecx, times_1, 1)); |
| 175 | __ idiv(Operand(esp, 12)); |
| 176 | __ div(edx); |
| 177 | __ div(Operand(edx, ecx, times_1, 1)); |
| 178 | __ div(Operand(esp, 12)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 179 | __ mul(edx); |
| 180 | __ neg(edx); |
| 181 | __ not_(edx); |
| 182 | __ test(Operand(ebx, ecx, times_4, 10000), Immediate(123456)); |
| 183 | |
| 184 | __ imul(edx, Operand(ebx, ecx, times_4, 10000)); |
| 185 | __ imul(edx, ecx, 12); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 186 | __ imul(edx, Operand(edx, eax, times_2, 42), 8); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 187 | __ imul(edx, ecx, 1000); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 188 | __ imul(edx, Operand(ebx, ecx, times_4, 1), 9000); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 189 | |
| 190 | __ inc(edx); |
| 191 | __ inc(Operand(ebx, ecx, times_4, 10000)); |
| 192 | __ push(Operand(ebx, ecx, times_4, 10000)); |
| 193 | __ pop(Operand(ebx, ecx, times_4, 10000)); |
| 194 | __ call(Operand(ebx, ecx, times_4, 10000)); |
| 195 | __ jmp(Operand(ebx, ecx, times_4, 10000)); |
| 196 | |
| 197 | __ lea(edx, Operand(ebx, ecx, times_4, 10000)); |
| 198 | __ or_(edx, 12345); |
| 199 | __ or_(edx, Operand(ebx, ecx, times_4, 10000)); |
| 200 | |
| 201 | __ nop(); |
| 202 | |
| 203 | __ rcl(edx, 1); |
| 204 | __ rcl(edx, 7); |
Iain Merrick | 7568138 | 2010-08-19 15:07:18 +0100 | [diff] [blame] | 205 | __ rcr(edx, 1); |
| 206 | __ rcr(edx, 7); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 207 | __ ror(edx, 1); |
| 208 | __ ror(edx, 6); |
| 209 | __ ror_cl(edx); |
| 210 | __ ror(Operand(ebx, ecx, times_4, 10000), 1); |
| 211 | __ ror(Operand(ebx, ecx, times_4, 10000), 6); |
| 212 | __ ror_cl(Operand(ebx, ecx, times_4, 10000)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 213 | __ sar(edx, 1); |
| 214 | __ sar(edx, 6); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 215 | __ sar_cl(edx); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 216 | __ sar(Operand(ebx, ecx, times_4, 10000), 1); |
| 217 | __ sar(Operand(ebx, ecx, times_4, 10000), 6); |
| 218 | __ sar_cl(Operand(ebx, ecx, times_4, 10000)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 219 | __ sbb(edx, Operand(ebx, ecx, times_4, 10000)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 220 | __ shl(edx, 1); |
| 221 | __ shl(edx, 6); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 222 | __ shl_cl(edx); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 223 | __ shl(Operand(ebx, ecx, times_4, 10000), 1); |
| 224 | __ shl(Operand(ebx, ecx, times_4, 10000), 6); |
| 225 | __ shl_cl(Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 226 | __ shrd_cl(Operand(ebx, ecx, times_4, 10000), edx); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 227 | __ shr(edx, 1); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 228 | __ shr(edx, 7); |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 229 | __ shr_cl(edx); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 230 | __ shr(Operand(ebx, ecx, times_4, 10000), 1); |
| 231 | __ shr(Operand(ebx, ecx, times_4, 10000), 6); |
| 232 | __ shr_cl(Operand(ebx, ecx, times_4, 10000)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 233 | |
| 234 | |
| 235 | // Immediates |
| 236 | |
| 237 | __ adc(edx, 12345); |
| 238 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 239 | __ add(ebx, Immediate(12)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 240 | __ add(Operand(edx, ecx, times_4, 10000), Immediate(12)); |
| 241 | |
| 242 | __ and_(ebx, 12345); |
| 243 | |
| 244 | __ cmp(ebx, 12345); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 245 | __ cmp(ebx, Immediate(12)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 246 | __ cmp(Operand(edx, ecx, times_4, 10000), Immediate(12)); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 247 | __ cmpb(eax, Immediate(100)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 248 | |
| 249 | __ or_(ebx, 12345); |
| 250 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 251 | __ sub(ebx, Immediate(12)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 252 | __ sub(Operand(edx, ecx, times_4, 10000), Immediate(12)); |
| 253 | |
| 254 | __ xor_(ebx, 12345); |
| 255 | |
| 256 | __ imul(edx, ecx, 12); |
| 257 | __ imul(edx, ecx, 1000); |
| 258 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 259 | __ cld(); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 260 | __ rep_movs(); |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 261 | __ rep_stos(); |
Leon Clarke | f7060e2 | 2010-06-03 12:02:55 +0100 | [diff] [blame] | 262 | __ stos(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 263 | |
| 264 | __ sub(edx, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 265 | __ sub(edx, ebx); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 266 | |
| 267 | __ test(edx, Immediate(12345)); |
| 268 | __ test(edx, Operand(ebx, ecx, times_8, 10000)); |
Ben Murdoch | 7f4d5bd | 2010-06-15 11:15:29 +0100 | [diff] [blame] | 269 | __ test(Operand(esi, edi, times_1, -20000000), Immediate(300000000)); |
| 270 | __ test_b(edx, Operand(ecx, ebx, times_2, 1000)); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 271 | __ test_b(Operand(eax, -20), Immediate(0x9A)); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 272 | __ nop(); |
| 273 | |
| 274 | __ xor_(edx, 12345); |
| 275 | __ xor_(edx, Operand(ebx, ecx, times_8, 10000)); |
| 276 | __ bts(Operand(ebx, ecx, times_8, 10000), edx); |
| 277 | __ hlt(); |
| 278 | __ int3(); |
| 279 | __ ret(0); |
| 280 | __ ret(8); |
| 281 | |
| 282 | // Calls |
| 283 | |
| 284 | Label L1, L2; |
| 285 | __ bind(&L1); |
| 286 | __ nop(); |
| 287 | __ call(&L1); |
| 288 | __ call(&L2); |
| 289 | __ nop(); |
| 290 | __ bind(&L2); |
| 291 | __ call(Operand(ebx, ecx, times_4, 10000)); |
| 292 | __ nop(); |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 293 | Handle<Code> ic(CodeFactory::LoadIC(isolate).code()); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 294 | __ call(ic, RelocInfo::CODE_TARGET); |
| 295 | __ nop(); |
| 296 | __ call(FUNCTION_ADDR(DummyStaticFunction), RelocInfo::RUNTIME_ENTRY); |
| 297 | __ nop(); |
| 298 | |
| 299 | __ jmp(&L1); |
| 300 | __ jmp(Operand(ebx, ecx, times_4, 10000)); |
| 301 | ExternalReference after_break_target = |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 302 | ExternalReference::debug_after_break_target_address(isolate); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 303 | __ jmp(Operand::StaticVariable(after_break_target)); |
| 304 | __ jmp(ic, RelocInfo::CODE_TARGET); |
| 305 | __ nop(); |
| 306 | |
| 307 | |
| 308 | Label Ljcc; |
| 309 | __ nop(); |
| 310 | // long jumps |
| 311 | __ j(overflow, &Ljcc); |
| 312 | __ j(no_overflow, &Ljcc); |
| 313 | __ j(below, &Ljcc); |
| 314 | __ j(above_equal, &Ljcc); |
| 315 | __ j(equal, &Ljcc); |
| 316 | __ j(not_equal, &Ljcc); |
| 317 | __ j(below_equal, &Ljcc); |
| 318 | __ j(above, &Ljcc); |
| 319 | __ j(sign, &Ljcc); |
| 320 | __ j(not_sign, &Ljcc); |
| 321 | __ j(parity_even, &Ljcc); |
| 322 | __ j(parity_odd, &Ljcc); |
| 323 | __ j(less, &Ljcc); |
| 324 | __ j(greater_equal, &Ljcc); |
| 325 | __ j(less_equal, &Ljcc); |
| 326 | __ j(greater, &Ljcc); |
| 327 | __ nop(); |
| 328 | __ bind(&Ljcc); |
| 329 | // short jumps |
| 330 | __ j(overflow, &Ljcc); |
| 331 | __ j(no_overflow, &Ljcc); |
| 332 | __ j(below, &Ljcc); |
| 333 | __ j(above_equal, &Ljcc); |
| 334 | __ j(equal, &Ljcc); |
| 335 | __ j(not_equal, &Ljcc); |
| 336 | __ j(below_equal, &Ljcc); |
| 337 | __ j(above, &Ljcc); |
| 338 | __ j(sign, &Ljcc); |
| 339 | __ j(not_sign, &Ljcc); |
| 340 | __ j(parity_even, &Ljcc); |
| 341 | __ j(parity_odd, &Ljcc); |
| 342 | __ j(less, &Ljcc); |
| 343 | __ j(greater_equal, &Ljcc); |
| 344 | __ j(less_equal, &Ljcc); |
| 345 | __ j(greater, &Ljcc); |
| 346 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 347 | // 0xD9 instructions |
| 348 | __ nop(); |
| 349 | |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 350 | __ fld(1); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 351 | __ fld1(); |
| 352 | __ fldz(); |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 353 | __ fldpi(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 354 | __ fabs(); |
| 355 | __ fchs(); |
| 356 | __ fprem(); |
| 357 | __ fprem1(); |
| 358 | __ fincstp(); |
| 359 | __ ftst(); |
| 360 | __ fxch(3); |
| 361 | __ fld_s(Operand(ebx, ecx, times_4, 10000)); |
| 362 | __ fstp_s(Operand(ebx, ecx, times_4, 10000)); |
| 363 | __ ffree(3); |
| 364 | __ fld_d(Operand(ebx, ecx, times_4, 10000)); |
| 365 | __ fstp_d(Operand(ebx, ecx, times_4, 10000)); |
| 366 | __ nop(); |
| 367 | |
| 368 | __ fild_s(Operand(ebx, ecx, times_4, 10000)); |
| 369 | __ fistp_s(Operand(ebx, ecx, times_4, 10000)); |
| 370 | __ fild_d(Operand(ebx, ecx, times_4, 10000)); |
| 371 | __ fistp_d(Operand(ebx, ecx, times_4, 10000)); |
| 372 | __ fnstsw_ax(); |
| 373 | __ nop(); |
| 374 | __ fadd(3); |
| 375 | __ fsub(3); |
| 376 | __ fmul(3); |
| 377 | __ fdiv(3); |
| 378 | |
| 379 | __ faddp(3); |
| 380 | __ fsubp(3); |
| 381 | __ fmulp(3); |
| 382 | __ fdivp(3); |
| 383 | __ fcompp(); |
| 384 | __ fwait(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 385 | __ frndint(); |
| 386 | __ fninit(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 387 | __ nop(); |
Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 388 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 389 | // SSE instruction |
| 390 | { |
| 391 | // Move operation |
| 392 | __ movaps(xmm0, xmm1); |
| 393 | __ shufps(xmm0, xmm0, 0x0); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 394 | __ cvtsd2ss(xmm0, xmm1); |
| 395 | __ cvtsd2ss(xmm0, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 396 | |
| 397 | // logic operation |
| 398 | __ andps(xmm0, xmm1); |
| 399 | __ andps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 400 | __ orps(xmm0, xmm1); |
| 401 | __ orps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 402 | __ xorps(xmm0, xmm1); |
| 403 | __ xorps(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 404 | |
| 405 | // Arithmetic operation |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 406 | __ addss(xmm1, xmm0); |
| 407 | __ addss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 408 | __ mulss(xmm1, xmm0); |
| 409 | __ mulss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 410 | __ subss(xmm1, xmm0); |
| 411 | __ subss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 412 | __ divss(xmm1, xmm0); |
| 413 | __ divss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 414 | __ maxss(xmm1, xmm0); |
| 415 | __ maxss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 416 | __ minss(xmm1, xmm0); |
| 417 | __ minss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 418 | __ sqrtss(xmm1, xmm0); |
| 419 | __ sqrtss(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 420 | __ addps(xmm1, xmm0); |
| 421 | __ addps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 422 | __ subps(xmm1, xmm0); |
| 423 | __ subps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 424 | __ mulps(xmm1, xmm0); |
| 425 | __ mulps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 426 | __ divps(xmm1, xmm0); |
| 427 | __ divps(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 428 | |
| 429 | __ ucomiss(xmm0, xmm1); |
| 430 | __ ucomiss(xmm0, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 431 | } |
| 432 | { |
| 433 | __ cvttss2si(edx, Operand(ebx, ecx, times_4, 10000)); |
| 434 | __ cvtsi2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 435 | __ cvtss2sd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 436 | __ cvtss2sd(xmm1, xmm0); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 437 | __ movsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 438 | __ movsd(Operand(ebx, ecx, times_4, 10000), xmm1); |
| 439 | // 128 bit move instructions. |
| 440 | __ movdqa(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 441 | __ movdqa(Operand(ebx, ecx, times_4, 10000), xmm0); |
| 442 | __ movdqu(xmm0, Operand(ebx, ecx, times_4, 10000)); |
| 443 | __ movdqu(Operand(ebx, ecx, times_4, 10000), xmm0); |
| 444 | |
| 445 | __ addsd(xmm1, xmm0); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 446 | __ addsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 447 | __ mulsd(xmm1, xmm0); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 448 | __ mulsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 449 | __ subsd(xmm1, xmm0); |
| 450 | __ subsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 451 | __ divsd(xmm1, xmm0); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 452 | __ divsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 453 | __ minsd(xmm1, xmm0); |
| 454 | __ minsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 455 | __ maxsd(xmm1, xmm0); |
| 456 | __ maxsd(xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 457 | __ ucomisd(xmm0, xmm1); |
| 458 | __ cmpltsd(xmm0, xmm1); |
| 459 | |
| 460 | __ andpd(xmm0, xmm1); |
| 461 | __ psllq(xmm0, 17); |
| 462 | __ psllq(xmm0, xmm1); |
| 463 | __ psrlq(xmm0, 17); |
| 464 | __ psrlq(xmm0, xmm1); |
| 465 | __ por(xmm0, xmm1); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 466 | |
| 467 | __ pcmpeqd(xmm1, xmm0); |
| 468 | |
| 469 | __ punpckldq(xmm1, xmm6); |
| 470 | __ punpckhdq(xmm7, xmm5); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 471 | } |
Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame] | 472 | |
| 473 | // cmov. |
| 474 | { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 475 | __ cmov(overflow, eax, Operand(eax, 0)); |
| 476 | __ cmov(no_overflow, eax, Operand(eax, 1)); |
| 477 | __ cmov(below, eax, Operand(eax, 2)); |
| 478 | __ cmov(above_equal, eax, Operand(eax, 3)); |
| 479 | __ cmov(equal, eax, Operand(ebx, 0)); |
| 480 | __ cmov(not_equal, eax, Operand(ebx, 1)); |
| 481 | __ cmov(below_equal, eax, Operand(ebx, 2)); |
| 482 | __ cmov(above, eax, Operand(ebx, 3)); |
| 483 | __ cmov(sign, eax, Operand(ecx, 0)); |
| 484 | __ cmov(not_sign, eax, Operand(ecx, 1)); |
| 485 | __ cmov(parity_even, eax, Operand(ecx, 2)); |
| 486 | __ cmov(parity_odd, eax, Operand(ecx, 3)); |
| 487 | __ cmov(less, eax, Operand(edx, 0)); |
| 488 | __ cmov(greater_equal, eax, Operand(edx, 1)); |
| 489 | __ cmov(less_equal, eax, Operand(edx, 2)); |
| 490 | __ cmov(greater, eax, Operand(edx, 3)); |
Kristian Monsen | 0d5e116 | 2010-09-30 15:31:59 +0100 | [diff] [blame] | 491 | } |
| 492 | |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 493 | { |
Ben Murdoch | 8b112d2 | 2011-06-08 16:22:53 +0100 | [diff] [blame] | 494 | if (CpuFeatures::IsSupported(SSE4_1)) { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 495 | CpuFeatureScope scope(&assm, SSE4_1); |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 496 | __ pextrd(eax, xmm0, 1); |
| 497 | __ pinsrd(xmm1, eax, 0); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 498 | __ extractps(eax, xmm1, 0); |
Steve Block | 1e0659c | 2011-05-24 12:43:12 +0100 | [diff] [blame] | 499 | } |
| 500 | } |
| 501 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 502 | // AVX instruction |
| 503 | { |
| 504 | if (CpuFeatures::IsSupported(AVX)) { |
| 505 | CpuFeatureScope scope(&assm, AVX); |
| 506 | __ vaddsd(xmm0, xmm1, xmm2); |
| 507 | __ vaddsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 508 | __ vmulsd(xmm0, xmm1, xmm2); |
| 509 | __ vmulsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 510 | __ vsubsd(xmm0, xmm1, xmm2); |
| 511 | __ vsubsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 512 | __ vdivsd(xmm0, xmm1, xmm2); |
| 513 | __ vdivsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 514 | __ vminsd(xmm0, xmm1, xmm2); |
| 515 | __ vminsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 516 | __ vmaxsd(xmm0, xmm1, xmm2); |
| 517 | __ vmaxsd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 518 | |
| 519 | __ vaddss(xmm0, xmm1, xmm2); |
| 520 | __ vaddss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 521 | __ vmulss(xmm0, xmm1, xmm2); |
| 522 | __ vmulss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 523 | __ vsubss(xmm0, xmm1, xmm2); |
| 524 | __ vsubss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 525 | __ vdivss(xmm0, xmm1, xmm2); |
| 526 | __ vdivss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 527 | __ vminss(xmm0, xmm1, xmm2); |
| 528 | __ vminss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 529 | __ vmaxss(xmm0, xmm1, xmm2); |
| 530 | __ vmaxss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 531 | |
| 532 | __ vandps(xmm0, xmm1, xmm2); |
| 533 | __ vandps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 534 | __ vxorps(xmm0, xmm1, xmm2); |
| 535 | __ vxorps(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 536 | |
| 537 | __ vandpd(xmm0, xmm1, xmm2); |
| 538 | __ vandpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 539 | __ vxorpd(xmm0, xmm1, xmm2); |
| 540 | __ vxorpd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 541 | } |
| 542 | } |
| 543 | |
| 544 | // FMA3 instruction |
| 545 | { |
| 546 | if (CpuFeatures::IsSupported(FMA3)) { |
| 547 | CpuFeatureScope scope(&assm, FMA3); |
| 548 | __ vfmadd132sd(xmm0, xmm1, xmm2); |
| 549 | __ vfmadd132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 550 | __ vfmadd213sd(xmm0, xmm1, xmm2); |
| 551 | __ vfmadd213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 552 | __ vfmadd231sd(xmm0, xmm1, xmm2); |
| 553 | __ vfmadd231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 554 | |
| 555 | __ vfmsub132sd(xmm0, xmm1, xmm2); |
| 556 | __ vfmsub132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 557 | __ vfmsub213sd(xmm0, xmm1, xmm2); |
| 558 | __ vfmsub213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 559 | __ vfmsub231sd(xmm0, xmm1, xmm2); |
| 560 | __ vfmsub231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 561 | |
| 562 | __ vfnmadd132sd(xmm0, xmm1, xmm2); |
| 563 | __ vfnmadd132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 564 | __ vfnmadd213sd(xmm0, xmm1, xmm2); |
| 565 | __ vfnmadd213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 566 | __ vfnmadd231sd(xmm0, xmm1, xmm2); |
| 567 | __ vfnmadd231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 568 | |
| 569 | __ vfnmsub132sd(xmm0, xmm1, xmm2); |
| 570 | __ vfnmsub132sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 571 | __ vfnmsub213sd(xmm0, xmm1, xmm2); |
| 572 | __ vfnmsub213sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 573 | __ vfnmsub231sd(xmm0, xmm1, xmm2); |
| 574 | __ vfnmsub231sd(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 575 | |
| 576 | __ vfmadd132ss(xmm0, xmm1, xmm2); |
| 577 | __ vfmadd132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 578 | __ vfmadd213ss(xmm0, xmm1, xmm2); |
| 579 | __ vfmadd213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 580 | __ vfmadd231ss(xmm0, xmm1, xmm2); |
| 581 | __ vfmadd231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 582 | |
| 583 | __ vfmsub132ss(xmm0, xmm1, xmm2); |
| 584 | __ vfmsub132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 585 | __ vfmsub213ss(xmm0, xmm1, xmm2); |
| 586 | __ vfmsub213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 587 | __ vfmsub231ss(xmm0, xmm1, xmm2); |
| 588 | __ vfmsub231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 589 | |
| 590 | __ vfnmadd132ss(xmm0, xmm1, xmm2); |
| 591 | __ vfnmadd132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 592 | __ vfnmadd213ss(xmm0, xmm1, xmm2); |
| 593 | __ vfnmadd213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 594 | __ vfnmadd231ss(xmm0, xmm1, xmm2); |
| 595 | __ vfnmadd231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 596 | |
| 597 | __ vfnmsub132ss(xmm0, xmm1, xmm2); |
| 598 | __ vfnmsub132ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 599 | __ vfnmsub213ss(xmm0, xmm1, xmm2); |
| 600 | __ vfnmsub213ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 601 | __ vfnmsub231ss(xmm0, xmm1, xmm2); |
| 602 | __ vfnmsub231ss(xmm0, xmm1, Operand(ebx, ecx, times_4, 10000)); |
| 603 | } |
| 604 | } |
| 605 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 606 | // BMI1 instructions |
| 607 | { |
| 608 | if (CpuFeatures::IsSupported(BMI1)) { |
| 609 | CpuFeatureScope scope(&assm, BMI1); |
| 610 | __ andn(eax, ebx, ecx); |
| 611 | __ andn(eax, ebx, Operand(ebx, ecx, times_4, 10000)); |
| 612 | __ bextr(eax, ebx, ecx); |
| 613 | __ bextr(eax, Operand(ebx, ecx, times_4, 10000), ebx); |
| 614 | __ blsi(eax, ebx); |
| 615 | __ blsi(eax, Operand(ebx, ecx, times_4, 10000)); |
| 616 | __ blsmsk(eax, ebx); |
| 617 | __ blsmsk(eax, Operand(ebx, ecx, times_4, 10000)); |
| 618 | __ blsr(eax, ebx); |
| 619 | __ blsr(eax, Operand(ebx, ecx, times_4, 10000)); |
| 620 | __ tzcnt(eax, ebx); |
| 621 | __ tzcnt(eax, Operand(ebx, ecx, times_4, 10000)); |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | // LZCNT instructions |
| 626 | { |
| 627 | if (CpuFeatures::IsSupported(LZCNT)) { |
| 628 | CpuFeatureScope scope(&assm, LZCNT); |
| 629 | __ lzcnt(eax, ebx); |
| 630 | __ lzcnt(eax, Operand(ebx, ecx, times_4, 10000)); |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | // POPCNT instructions |
| 635 | { |
| 636 | if (CpuFeatures::IsSupported(POPCNT)) { |
| 637 | CpuFeatureScope scope(&assm, POPCNT); |
| 638 | __ popcnt(eax, ebx); |
| 639 | __ popcnt(eax, Operand(ebx, ecx, times_4, 10000)); |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | // BMI2 instructions |
| 644 | { |
| 645 | if (CpuFeatures::IsSupported(BMI2)) { |
| 646 | CpuFeatureScope scope(&assm, BMI2); |
| 647 | __ bzhi(eax, ebx, ecx); |
| 648 | __ bzhi(eax, Operand(ebx, ecx, times_4, 10000), ebx); |
| 649 | __ mulx(eax, ebx, ecx); |
| 650 | __ mulx(eax, ebx, Operand(ebx, ecx, times_4, 10000)); |
| 651 | __ pdep(eax, ebx, ecx); |
| 652 | __ pdep(eax, ebx, Operand(ebx, ecx, times_4, 10000)); |
| 653 | __ pext(eax, ebx, ecx); |
| 654 | __ pext(eax, ebx, Operand(ebx, ecx, times_4, 10000)); |
| 655 | __ sarx(eax, ebx, ecx); |
| 656 | __ sarx(eax, Operand(ebx, ecx, times_4, 10000), ebx); |
| 657 | __ shlx(eax, ebx, ecx); |
| 658 | __ shlx(eax, Operand(ebx, ecx, times_4, 10000), ebx); |
| 659 | __ shrx(eax, ebx, ecx); |
| 660 | __ shrx(eax, Operand(ebx, ecx, times_4, 10000), ebx); |
| 661 | __ rorx(eax, ebx, 31); |
| 662 | __ rorx(eax, Operand(ebx, ecx, times_4, 10000), 31); |
| 663 | } |
| 664 | } |
| 665 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 666 | // xchg. |
| 667 | { |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 668 | __ xchg_b(eax, Operand(eax, 8)); |
| 669 | __ xchg_w(eax, Operand(ebx, 8)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 670 | __ xchg(eax, eax); |
| 671 | __ xchg(eax, ebx); |
| 672 | __ xchg(ebx, ebx); |
| 673 | __ xchg(ebx, Operand(esp, 12)); |
| 674 | } |
| 675 | |
Ben Murdoch | 61f157c | 2016-09-16 13:49:30 +0100 | [diff] [blame] | 676 | // cmpxchg. |
| 677 | { |
| 678 | __ cmpxchg_b(Operand(esp, 12), eax); |
| 679 | __ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax); |
| 680 | __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax); |
| 681 | } |
| 682 | |
| 683 | // lock prefix. |
| 684 | { |
| 685 | __ lock(); |
| 686 | __ cmpxchg(Operand(esp, 12), ebx); |
| 687 | |
| 688 | __ lock(); |
| 689 | __ xchg_w(eax, Operand(ecx, 8)); |
| 690 | } |
| 691 | |
Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 692 | // Nop instructions |
| 693 | for (int i = 0; i < 16; i++) { |
| 694 | __ Nop(i); |
| 695 | } |
| 696 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 697 | __ ret(0); |
| 698 | |
| 699 | CodeDesc desc; |
| 700 | assm.GetCode(&desc); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 701 | Handle<Code> code = isolate->factory()->NewCode( |
| 702 | desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 703 | USE(code); |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 704 | #ifdef OBJECT_PRINT |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 705 | OFStream os(stdout); |
| 706 | code->Print(os); |
| 707 | byte* begin = code->instruction_start(); |
| 708 | byte* end = begin + code->instruction_size(); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 709 | disasm::Disassembler::Disassemble(stdout, begin, end); |
| 710 | #endif |
| 711 | } |
| 712 | |
| 713 | #undef __ |