1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "assembler_x86.h"
18
19 #include "base/arena_allocator.h"
20 #include "base/malloc_arena_pool.h"
21 #include "base/stl_util.h"
22 #include "utils/assembler_test.h"
23
24 namespace art {
25
TEST(AssemblerX86,CreateBuffer)26 TEST(AssemblerX86, CreateBuffer) {
27 MallocArenaPool pool;
28 ArenaAllocator allocator(&pool);
29 AssemblerBuffer buffer(&allocator);
30 AssemblerBuffer::EnsureCapacity ensured(&buffer);
31 buffer.Emit<uint8_t>(0x42);
32 ASSERT_EQ(static_cast<size_t>(1), buffer.Size());
33 buffer.Emit<int32_t>(42);
34 ASSERT_EQ(static_cast<size_t>(5), buffer.Size());
35 }
36
37 //
38 // Test fixture.
39 //
40
41 class AssemblerX86Test : public AssemblerTest<x86::X86Assembler,
42 x86::Address,
43 x86::Register,
44 x86::XmmRegister,
45 x86::Immediate> {
46 public:
47 using Base = AssemblerTest<x86::X86Assembler,
48 x86::Address,
49 x86::Register,
50 x86::XmmRegister,
51 x86::Immediate>;
52
53 protected:
GetIsa()54 InstructionSet GetIsa() override {
55 return InstructionSet::kX86;
56 }
57
SetUpHelpers()58 void SetUpHelpers() override {
59 if (addresses_singleton_.size() == 0) {
60 // One addressing mode to test the repeat drivers.
61 addresses_singleton_.push_back(x86::Address(x86::EAX, x86::EBX, x86::TIMES_1, 2));
62 }
63
64 if (addresses_.size() == 0) {
65 // Several addressing modes.
66 addresses_.push_back(x86::Address(x86::EDI, x86::EAX, x86::TIMES_1, 15));
67 addresses_.push_back(x86::Address(x86::EDI, x86::EBX, x86::TIMES_2, 16));
68 addresses_.push_back(x86::Address(x86::EDI, x86::ECX, x86::TIMES_4, 17));
69 addresses_.push_back(x86::Address(x86::EDI, x86::EDX, x86::TIMES_8, 18));
70 addresses_.push_back(x86::Address(x86::EAX, -1));
71 addresses_.push_back(x86::Address(x86::EBX, 0));
72 addresses_.push_back(x86::Address(x86::ESI, 1));
73 addresses_.push_back(x86::Address(x86::EDI, 987654321));
74 // Several addressing modes with the special ESP.
75 addresses_.push_back(x86::Address(x86::ESP, x86::EAX, x86::TIMES_1, 15));
76 addresses_.push_back(x86::Address(x86::ESP, x86::EBX, x86::TIMES_2, 16));
77 addresses_.push_back(x86::Address(x86::ESP, x86::ECX, x86::TIMES_4, 17));
78 addresses_.push_back(x86::Address(x86::ESP, x86::EDX, x86::TIMES_8, 18));
79 addresses_.push_back(x86::Address(x86::ESP, -1));
80 addresses_.push_back(x86::Address(x86::ESP, 0));
81 addresses_.push_back(x86::Address(x86::ESP, 1));
82 addresses_.push_back(x86::Address(x86::ESP, 987654321));
83 }
84 if (registers_.size() == 0) {
85 registers_.insert(end(registers_),
86 {
87 new x86::Register(x86::EAX),
88 new x86::Register(x86::EBX),
89 new x86::Register(x86::ECX),
90 new x86::Register(x86::EDX),
91 new x86::Register(x86::EBP),
92 new x86::Register(x86::ESP),
93 new x86::Register(x86::ESI),
94 new x86::Register(x86::EDI)
95 });
96 }
97
98 if (fp_registers_.size() == 0) {
99 fp_registers_.insert(end(fp_registers_),
100 {
101 new x86::XmmRegister(x86::XMM0),
102 new x86::XmmRegister(x86::XMM1),
103 new x86::XmmRegister(x86::XMM2),
104 new x86::XmmRegister(x86::XMM3),
105 new x86::XmmRegister(x86::XMM4),
106 new x86::XmmRegister(x86::XMM5),
107 new x86::XmmRegister(x86::XMM6),
108 new x86::XmmRegister(x86::XMM7)
109 });
110 }
111 }
112
TearDown()113 void TearDown() override {
114 AssemblerTest::TearDown();
115 STLDeleteElements(®isters_);
116 STLDeleteElements(&fp_registers_);
117 }
118
GetAddresses()119 std::vector<x86::Address> GetAddresses() override {
120 return addresses_;
121 }
122
GetRegisters()123 std::vector<x86::Register*> GetRegisters() override {
124 return registers_;
125 }
126
GetFPRegisters()127 std::vector<x86::XmmRegister*> GetFPRegisters() override {
128 return fp_registers_;
129 }
130
CreateImmediate(int64_t imm_value)131 x86::Immediate CreateImmediate(int64_t imm_value) override {
132 return x86::Immediate(imm_value);
133 }
134
135 std::vector<x86::Address> addresses_singleton_;
136
137 private:
138 std::vector<x86::Address> addresses_;
139 std::vector<x86::Register*> registers_;
140 std::vector<x86::XmmRegister*> fp_registers_;
141 };
142
143 class AssemblerX86AVXTest : public AssemblerX86Test {
144 public:
AssemblerX86AVXTest()145 AssemblerX86AVXTest()
146 : instruction_set_features_(X86InstructionSetFeatures::FromVariant("kabylake", nullptr)) {}
147 protected:
CreateAssembler(ArenaAllocator * allocator)148 x86::X86Assembler* CreateAssembler(ArenaAllocator* allocator) override {
149 return new (allocator) x86::X86Assembler(allocator, instruction_set_features_.get());
150 }
151 private:
152 std::unique_ptr<const X86InstructionSetFeatures> instruction_set_features_;
153 };
154
155 //
156 // Test some repeat drivers used in the tests.
157 //
158
TEST_F(AssemblerX86Test,RepeatRR)159 TEST_F(AssemblerX86Test, RepeatRR) {
160 EXPECT_NE(RepeatRR(/*f*/ nullptr, "%{reg1} %{reg2}")
161 .find("%eax %eax\n%eax %ebx\n%eax %ecx\n%eax %edx\n%eax %ebp\n%eax %esp\n%eax %esi\n"
162 "%eax %edi\n%ebx %eax\n%ebx %ebx\n%ebx %ecx\n%ebx %edx\n%ebx %ebp\n%ebx %esp\n"),
163 std::string::npos);
164 }
165
TEST_F(AssemblerX86Test,RepeatRI)166 TEST_F(AssemblerX86Test, RepeatRI) {
167 EXPECT_EQ("%eax $0\n%eax $-1\n%eax $18\n%ebx $0\n%ebx $-1\n%ebx $18\n%ecx $0\n%ecx $-1\n"
168 "%ecx $18\n%edx $0\n%edx $-1\n%edx $18\n%ebp $0\n%ebp $-1\n%ebp $18\n%esp $0\n"
169 "%esp $-1\n%esp $18\n%esi $0\n%esi $-1\n%esi $18\n%edi $0\n%edi $-1\n%edi $18\n",
170 RepeatRI(/*f*/ nullptr, /*imm_bytes*/ 1U, "%{reg} ${imm}"));
171 }
172
TEST_F(AssemblerX86Test,RepeatFF)173 TEST_F(AssemblerX86Test, RepeatFF) {
174 EXPECT_NE(RepeatFF(/*f*/ nullptr, "%{reg1} %{reg2}")
175 .find("%XMM0 %XMM0\n%XMM0 %XMM1\n%XMM0 %XMM2\n%XMM0 %XMM3\n%XMM0 %XMM4\n%XMM0 %XMM5\n"
176 "%XMM0 %XMM6\n%XMM0 %XMM7\n%XMM1 %XMM0\n%XMM1 %XMM1\n%XMM1 %XMM2\n%XMM1 %XMM3\n"),
177 std::string::npos);
178 }
179
TEST_F(AssemblerX86Test,RepeatFFI)180 TEST_F(AssemblerX86Test, RepeatFFI) {
181 EXPECT_NE(RepeatFFI(/*f*/ nullptr, /*imm_bytes*/ 1U, "%{reg1} %{reg2} ${imm}")
182 .find("%XMM0 %XMM0 $0\n%XMM0 %XMM0 $-1\n%XMM0 %XMM0 $18\n"
183 "%XMM0 %XMM1 $0\n%XMM0 %XMM1 $-1\n%XMM0 %XMM1 $18\n"),
184 std::string::npos);
185 }
186
TEST_F(AssemblerX86Test,RepeatA)187 TEST_F(AssemblerX86Test, RepeatA) {
188 EXPECT_EQ("2(%eax,%ebx,1)\n", RepeatA(/*f*/ nullptr, addresses_singleton_, "{mem}"));
189 }
190
TEST_F(AssemblerX86Test,RepeatAI)191 TEST_F(AssemblerX86Test, RepeatAI) {
192 EXPECT_EQ("2(%eax,%ebx,1) $0\n2(%eax,%ebx,1) $-1\n2(%eax,%ebx,1) $18\n",
193 RepeatAI(/*f*/ nullptr, /*imm_bytes*/ 1U, addresses_singleton_, "{mem} ${imm}"));
194 }
195
TEST_F(AssemblerX86Test,RepeatRA)196 TEST_F(AssemblerX86Test, RepeatRA) {
197 EXPECT_EQ("%eax 2(%eax,%ebx,1)\n%ebx 2(%eax,%ebx,1)\n%ecx 2(%eax,%ebx,1)\n"
198 "%edx 2(%eax,%ebx,1)\n%ebp 2(%eax,%ebx,1)\n%esp 2(%eax,%ebx,1)\n"
199 "%esi 2(%eax,%ebx,1)\n%edi 2(%eax,%ebx,1)\n",
200 RepeatRA(/*f*/ nullptr, addresses_singleton_, "%{reg} {mem}"));
201 }
202
TEST_F(AssemblerX86Test,RepeatAR)203 TEST_F(AssemblerX86Test, RepeatAR) {
204 EXPECT_EQ("2(%eax,%ebx,1) %eax\n2(%eax,%ebx,1) %ebx\n2(%eax,%ebx,1) %ecx\n"
205 "2(%eax,%ebx,1) %edx\n2(%eax,%ebx,1) %ebp\n2(%eax,%ebx,1) %esp\n"
206 "2(%eax,%ebx,1) %esi\n2(%eax,%ebx,1) %edi\n",
207 RepeatAR(/*f*/ nullptr, addresses_singleton_, "{mem} %{reg}"));
208 }
209
TEST_F(AssemblerX86Test,RepeatFA)210 TEST_F(AssemblerX86Test, RepeatFA) {
211 EXPECT_EQ("%XMM0 2(%eax,%ebx,1)\n%XMM1 2(%eax,%ebx,1)\n%XMM2 2(%eax,%ebx,1)\n"
212 "%XMM3 2(%eax,%ebx,1)\n%XMM4 2(%eax,%ebx,1)\n%XMM5 2(%eax,%ebx,1)\n"
213 "%XMM6 2(%eax,%ebx,1)\n%XMM7 2(%eax,%ebx,1)\n",
214 RepeatFA(/*f*/ nullptr, addresses_singleton_, "%{reg} {mem}"));
215 }
216
TEST_F(AssemblerX86Test,RepeatAF)217 TEST_F(AssemblerX86Test, RepeatAF) {
218 EXPECT_EQ("2(%eax,%ebx,1) %XMM0\n2(%eax,%ebx,1) %XMM1\n2(%eax,%ebx,1) %XMM2\n"
219 "2(%eax,%ebx,1) %XMM3\n2(%eax,%ebx,1) %XMM4\n2(%eax,%ebx,1) %XMM5\n"
220 "2(%eax,%ebx,1) %XMM6\n2(%eax,%ebx,1) %XMM7\n",
221 RepeatAF(/*f*/ nullptr, addresses_singleton_, "{mem} %{reg}"));
222 }
223
224 //
225 // Actual x86 instruction assembler tests.
226 //
227
TEST_F(AssemblerX86Test,PoplAllAddresses)228 TEST_F(AssemblerX86Test, PoplAllAddresses) {
229 // Make sure all addressing modes combinations are tested at least once.
230 std::vector<x86::Address> all_addresses;
231 for (x86::Register* base : GetRegisters()) {
232 // Base only.
233 all_addresses.push_back(x86::Address(*base, -1));
234 all_addresses.push_back(x86::Address(*base, 0));
235 all_addresses.push_back(x86::Address(*base, 1));
236 all_addresses.push_back(x86::Address(*base, 123456789));
237 for (x86::Register* index : GetRegisters()) {
238 if (*index == x86::ESP) {
239 // Index cannot be ESP.
240 continue;
241 } else if (*base == *index) {
242 // Index only.
243 all_addresses.push_back(x86::Address(*index, x86::TIMES_1, -1));
244 all_addresses.push_back(x86::Address(*index, x86::TIMES_2, 0));
245 all_addresses.push_back(x86::Address(*index, x86::TIMES_4, 1));
246 all_addresses.push_back(x86::Address(*index, x86::TIMES_8, 123456789));
247 }
248 // Base and index.
249 all_addresses.push_back(x86::Address(*base, *index, x86::TIMES_1, -1));
250 all_addresses.push_back(x86::Address(*base, *index, x86::TIMES_2, 0));
251 all_addresses.push_back(x86::Address(*base, *index, x86::TIMES_4, 1));
252 all_addresses.push_back(x86::Address(*base, *index, x86::TIMES_8, 123456789));
253 }
254 }
255 DriverStr(RepeatA(&x86::X86Assembler::popl, all_addresses, "popl {mem}"), "popq");
256 }
257
TEST_F(AssemblerX86Test,Movl)258 TEST_F(AssemblerX86Test, Movl) {
259 DriverStr(RepeatRR(&x86::X86Assembler::movl, "movl %{reg2}, %{reg1}"), "movl");
260 }
261
TEST_F(AssemblerX86Test,MovlLoad)262 TEST_F(AssemblerX86Test, MovlLoad) {
263 DriverStr(RepeatRA(&x86::X86Assembler::movl, "movl {mem}, %{reg}"), "movl-load");
264 }
265
TEST_F(AssemblerX86Test,Addw)266 TEST_F(AssemblerX86Test, Addw) {
267 DriverStr(RepeatAI(&x86::X86Assembler::addw, /*imm_bytes*/ 2U, "addw ${imm}, {mem}"), "addw");
268 }
269
TEST_F(AssemblerX86Test,MovlStore)270 TEST_F(AssemblerX86Test, MovlStore) {
271 DriverStr(RepeatAR(&x86::X86Assembler::movl, "movl %{reg}, {mem}"), "movl-store");
272 }
273
TEST_F(AssemblerX86Test,Movntl)274 TEST_F(AssemblerX86Test, Movntl) {
275 DriverStr(RepeatAR(&x86::X86Assembler::movntl, "movntil %{reg}, {mem}"), "movntl");
276 }
277
TEST_F(AssemblerX86Test,LoadLongConstant)278 TEST_F(AssemblerX86Test, LoadLongConstant) {
279 GetAssembler()->LoadLongConstant(x86::XMM0, 51);
280 const char* expected =
281 "push $0x0\n"
282 "push $0x33\n"
283 "movsd 0(%esp), %xmm0\n"
284 "add $8, %esp\n";
285 DriverStr(expected, "LoadLongConstant");
286 }
287
TEST_F(AssemblerX86Test,LockCmpxchgl)288 TEST_F(AssemblerX86Test, LockCmpxchgl) {
289 DriverStr(RepeatAR(&x86::X86Assembler::LockCmpxchgl,
290 "lock cmpxchgl %{reg}, {mem}"), "lock_cmpxchgl");
291 }
292
TEST_F(AssemblerX86Test,LockCmpxchg8b)293 TEST_F(AssemblerX86Test, LockCmpxchg8b) {
294 DriverStr(RepeatA(&x86::X86Assembler::LockCmpxchg8b,
295 "lock cmpxchg8b {mem}"), "lock_cmpxchg8b");
296 }
297
TEST_F(AssemblerX86Test,FPUIntegerLoadS)298 TEST_F(AssemblerX86Test, FPUIntegerLoadS) {
299 DriverStr(RepeatA(&x86::X86Assembler::filds, "fildl {mem}"), "fildd");
300 }
301
TEST_F(AssemblerX86Test,FPUIntegerLoadL)302 TEST_F(AssemblerX86Test, FPUIntegerLoadL) {
303 DriverStr(RepeatA(&x86::X86Assembler::fildl, "fildll {mem}"), "fildl");
304 }
305
TEST_F(AssemblerX86Test,FPUIntegerStoreS)306 TEST_F(AssemblerX86Test, FPUIntegerStoreS) {
307 DriverStr(RepeatA(&x86::X86Assembler::fistps, "fistpl {mem}"), "fistps");
308 }
309
TEST_F(AssemblerX86Test,FPUIntegerStoreL)310 TEST_F(AssemblerX86Test, FPUIntegerStoreL) {
311 DriverStr(RepeatA(&x86::X86Assembler::fistpl, "fistpll {mem}"), "fistpl");
312 }
313
TEST_F(AssemblerX86Test,Repnescasb)314 TEST_F(AssemblerX86Test, Repnescasb) {
315 GetAssembler()->repne_scasb();
316 const char* expected = "repne scasb\n";
317 DriverStr(expected, "Repnescasb");
318 }
319
TEST_F(AssemblerX86Test,Repnescasw)320 TEST_F(AssemblerX86Test, Repnescasw) {
321 GetAssembler()->repne_scasw();
322 const char* expected = "repne scasw\n";
323 DriverStr(expected, "Repnescasw");
324 }
325
TEST_F(AssemblerX86Test,Repecmpsb)326 TEST_F(AssemblerX86Test, Repecmpsb) {
327 GetAssembler()->repe_cmpsb();
328 const char* expected = "repe cmpsb\n";
329 DriverStr(expected, "Repecmpsb");
330 }
331
TEST_F(AssemblerX86Test,Repecmpsw)332 TEST_F(AssemblerX86Test, Repecmpsw) {
333 GetAssembler()->repe_cmpsw();
334 const char* expected = "repe cmpsw\n";
335 DriverStr(expected, "Repecmpsw");
336 }
337
TEST_F(AssemblerX86Test,Repecmpsl)338 TEST_F(AssemblerX86Test, Repecmpsl) {
339 GetAssembler()->repe_cmpsl();
340 const char* expected = "repe cmpsl\n";
341 DriverStr(expected, "Repecmpsl");
342 }
343
TEST_F(AssemblerX86Test,RepMovsb)344 TEST_F(AssemblerX86Test, RepMovsb) {
345 GetAssembler()->rep_movsb();
346 const char* expected = "rep movsb\n";
347 DriverStr(expected, "rep_movsb");
348 }
349
TEST_F(AssemblerX86Test,RepMovsw)350 TEST_F(AssemblerX86Test, RepMovsw) {
351 GetAssembler()->rep_movsw();
352 const char* expected = "rep movsw\n";
353 DriverStr(expected, "rep_movsw");
354 }
355
TEST_F(AssemblerX86Test,Blsmask)356 TEST_F(AssemblerX86Test, Blsmask) {
357 DriverStr(RepeatRR(&x86::X86Assembler::blsmsk, "blsmsk %{reg2}, %{reg1}"), "blsmsk");
358 }
359
TEST_F(AssemblerX86Test,Blsi)360 TEST_F(AssemblerX86Test, Blsi) {
361 DriverStr(RepeatRR(&x86::X86Assembler::blsi, "blsi %{reg2}, %{reg1}"), "blsi");
362 }
363
TEST_F(AssemblerX86Test,Blsr)364 TEST_F(AssemblerX86Test, Blsr) {
365 DriverStr(RepeatRR(&x86::X86Assembler::blsr, "blsr %{reg2}, %{reg1}"), "blsr");
366 }
367
TEST_F(AssemblerX86Test,Bsfl)368 TEST_F(AssemblerX86Test, Bsfl) {
369 DriverStr(RepeatRR(&x86::X86Assembler::bsfl, "bsfl %{reg2}, %{reg1}"), "bsfl");
370 }
371
TEST_F(AssemblerX86Test,BsflAddress)372 TEST_F(AssemblerX86Test, BsflAddress) {
373 DriverStr(RepeatRA(&x86::X86Assembler::bsfl, "bsfl {mem}, %{reg}"), "bsfl_address");
374 }
375
TEST_F(AssemblerX86Test,Bsrl)376 TEST_F(AssemblerX86Test, Bsrl) {
377 DriverStr(RepeatRR(&x86::X86Assembler::bsrl, "bsrl %{reg2}, %{reg1}"), "bsrl");
378 }
379
TEST_F(AssemblerX86Test,BsrlAddress)380 TEST_F(AssemblerX86Test, BsrlAddress) {
381 DriverStr(RepeatRA(&x86::X86Assembler::bsrl, "bsrl {mem}, %{reg}"), "bsrl_address");
382 }
383
TEST_F(AssemblerX86Test,Popcntl)384 TEST_F(AssemblerX86Test, Popcntl) {
385 DriverStr(RepeatRR(&x86::X86Assembler::popcntl, "popcntl %{reg2}, %{reg1}"), "popcntl");
386 }
387
TEST_F(AssemblerX86Test,PopcntlAddress)388 TEST_F(AssemblerX86Test, PopcntlAddress) {
389 DriverStr(RepeatRA(&x86::X86Assembler::popcntl, "popcntl {mem}, %{reg}"), "popcntl_address");
390 }
391
392 // Rorl only allows CL as the shift count.
rorl_fn(AssemblerX86Test::Base * assembler_test,x86::X86Assembler * assembler)393 std::string rorl_fn(AssemblerX86Test::Base* assembler_test, x86::X86Assembler* assembler) {
394 std::ostringstream str;
395 std::vector<x86::Register*> registers = assembler_test->GetRegisters();
396 x86::Register shifter(x86::ECX);
397 for (auto reg : registers) {
398 assembler->rorl(*reg, shifter);
399 str << "rorl %cl, %" << assembler_test->GetRegisterName(*reg) << "\n";
400 }
401 return str.str();
402 }
403
TEST_F(AssemblerX86Test,RorlReg)404 TEST_F(AssemblerX86Test, RorlReg) {
405 DriverFn(&rorl_fn, "rorl");
406 }
407
TEST_F(AssemblerX86Test,RorlImm)408 TEST_F(AssemblerX86Test, RorlImm) {
409 DriverStr(RepeatRI(&x86::X86Assembler::rorl, /*imm_bytes*/ 1U, "rorl ${imm}, %{reg}"), "rorli");
410 }
411
412 // Roll only allows CL as the shift count.
roll_fn(AssemblerX86Test::Base * assembler_test,x86::X86Assembler * assembler)413 std::string roll_fn(AssemblerX86Test::Base* assembler_test, x86::X86Assembler* assembler) {
414 std::ostringstream str;
415 std::vector<x86::Register*> registers = assembler_test->GetRegisters();
416 x86::Register shifter(x86::ECX);
417 for (auto reg : registers) {
418 assembler->roll(*reg, shifter);
419 str << "roll %cl, %" << assembler_test->GetRegisterName(*reg) << "\n";
420 }
421 return str.str();
422 }
423
TEST_F(AssemblerX86Test,RollReg)424 TEST_F(AssemblerX86Test, RollReg) {
425 DriverFn(&roll_fn, "roll");
426 }
427
TEST_F(AssemblerX86Test,RollImm)428 TEST_F(AssemblerX86Test, RollImm) {
429 DriverStr(RepeatRI(&x86::X86Assembler::roll, /*imm_bytes*/ 1U, "roll ${imm}, %{reg}"), "rolli");
430 }
431
TEST_F(AssemblerX86Test,Cvtdq2ps)432 TEST_F(AssemblerX86Test, Cvtdq2ps) {
433 DriverStr(RepeatFF(&x86::X86Assembler::cvtdq2ps, "cvtdq2ps %{reg2}, %{reg1}"), "cvtdq2ps");
434 }
435
TEST_F(AssemblerX86Test,Cvtdq2pd)436 TEST_F(AssemblerX86Test, Cvtdq2pd) {
437 DriverStr(RepeatFF(&x86::X86Assembler::cvtdq2pd, "cvtdq2pd %{reg2}, %{reg1}"), "cvtdq2pd");
438 }
439
TEST_F(AssemblerX86Test,ComissAddr)440 TEST_F(AssemblerX86Test, ComissAddr) {
441 DriverStr(RepeatFA(&x86::X86Assembler::comiss, "comiss {mem}, %{reg}"), "comiss");
442 }
443
TEST_F(AssemblerX86Test,UComissAddr)444 TEST_F(AssemblerX86Test, UComissAddr) {
445 DriverStr(RepeatFA(&x86::X86Assembler::ucomiss, "ucomiss {mem}, %{reg}"), "ucomiss");
446 }
447
TEST_F(AssemblerX86Test,ComisdAddr)448 TEST_F(AssemblerX86Test, ComisdAddr) {
449 DriverStr(RepeatFA(&x86::X86Assembler::comisd, "comisd {mem}, %{reg}"), "comisd");
450 }
451
TEST_F(AssemblerX86Test,UComisdAddr)452 TEST_F(AssemblerX86Test, UComisdAddr) {
453 DriverStr(RepeatFA(&x86::X86Assembler::ucomisd, "ucomisd {mem}, %{reg}"), "ucomisd");
454 }
455
TEST_F(AssemblerX86Test,RoundSS)456 TEST_F(AssemblerX86Test, RoundSS) {
457 DriverStr(RepeatFFI(&x86::X86Assembler::roundss, /*imm_bytes*/ 1U,
458 "roundss ${imm}, %{reg2}, %{reg1}"), "roundss");
459 }
460
TEST_F(AssemblerX86Test,RoundSD)461 TEST_F(AssemblerX86Test, RoundSD) {
462 DriverStr(RepeatFFI(&x86::X86Assembler::roundsd, /*imm_bytes*/ 1U,
463 "roundsd ${imm}, %{reg2}, %{reg1}"), "roundsd");
464 }
465
TEST_F(AssemblerX86Test,CmovlAddress)466 TEST_F(AssemblerX86Test, CmovlAddress) {
467 GetAssembler()->cmovl(x86::kEqual, x86::Register(x86::EAX), x86::Address(
468 x86::Register(x86::EDI), x86::Register(x86::EBX), x86::TIMES_4, 12));
469 GetAssembler()->cmovl(x86::kNotEqual, x86::Register(x86::EDI), x86::Address(
470 x86::Register(x86::ESI), x86::Register(x86::EBX), x86::TIMES_4, 12));
471 GetAssembler()->cmovl(x86::kEqual, x86::Register(x86::EDI), x86::Address(
472 x86::Register(x86::EDI), x86::Register(x86::EAX), x86::TIMES_4, 12));
473 const char* expected =
474 "cmovzl 0xc(%EDI,%EBX,4), %eax\n"
475 "cmovnzl 0xc(%ESI,%EBX,4), %edi\n"
476 "cmovzl 0xc(%EDI,%EAX,4), %edi\n";
477 DriverStr(expected, "cmovl_address");
478 }
479
TEST_F(AssemblerX86Test,TestbAddressImmediate)480 TEST_F(AssemblerX86Test, TestbAddressImmediate) {
481 DriverStr(RepeatAI(&x86::X86Assembler::testb, /*imm_bytes*/ 1U, "testb ${imm}, {mem}"), "testb");
482 }
483
TEST_F(AssemblerX86Test,TestlAddressImmediate)484 TEST_F(AssemblerX86Test, TestlAddressImmediate) {
485 DriverStr(RepeatAI(&x86::X86Assembler::testl, /*imm_bytes*/ 4U, "testl ${imm}, {mem}"), "testl");
486 }
487
TEST_F(AssemblerX86Test,Movaps)488 TEST_F(AssemblerX86Test, Movaps) {
489 DriverStr(RepeatFF(&x86::X86Assembler::movaps, "movaps %{reg2}, %{reg1}"), "movaps");
490 }
491
TEST_F(AssemblerX86AVXTest,VMovaps)492 TEST_F(AssemblerX86AVXTest, VMovaps) {
493 DriverStr(RepeatFF(&x86::X86Assembler::vmovaps, "vmovaps %{reg2}, %{reg1}"), "vmovaps");
494 }
495
TEST_F(AssemblerX86AVXTest,Movaps)496 TEST_F(AssemblerX86AVXTest, Movaps) {
497 DriverStr(RepeatFF(&x86::X86Assembler::movaps, "vmovaps %{reg2}, %{reg1}"), "avx_movaps");
498 }
499
TEST_F(AssemblerX86Test,MovapsLoad)500 TEST_F(AssemblerX86Test, MovapsLoad) {
501 DriverStr(RepeatFA(&x86::X86Assembler::movaps, "movaps {mem}, %{reg}"), "movaps_load");
502 }
503
TEST_F(AssemblerX86AVXTest,VMovapsLoad)504 TEST_F(AssemblerX86AVXTest, VMovapsLoad) {
505 DriverStr(RepeatFA(&x86::X86Assembler::vmovaps, "vmovaps {mem}, %{reg}"), "vmovaps_load");
506 }
507
TEST_F(AssemblerX86AVXTest,MovapsLoad)508 TEST_F(AssemblerX86AVXTest, MovapsLoad) {
509 DriverStr(RepeatFA(&x86::X86Assembler::movaps, "vmovaps {mem}, %{reg}"), "avx_movaps_load");
510 }
511
TEST_F(AssemblerX86Test,MovapsStore)512 TEST_F(AssemblerX86Test, MovapsStore) {
513 DriverStr(RepeatAF(&x86::X86Assembler::movaps, "movaps %{reg}, {mem}"), "movaps_store");
514 }
515
TEST_F(AssemblerX86AVXTest,VMovapsStore)516 TEST_F(AssemblerX86AVXTest, VMovapsStore) {
517 DriverStr(RepeatAF(&x86::X86Assembler::vmovaps, "vmovaps %{reg}, {mem}"), "vmovaps_store");
518 }
519
TEST_F(AssemblerX86AVXTest,MovapsStore)520 TEST_F(AssemblerX86AVXTest, MovapsStore) {
521 DriverStr(RepeatAF(&x86::X86Assembler::movaps, "vmovaps %{reg}, {mem}"), "avx_movaps_store");
522 }
523
TEST_F(AssemblerX86Test,MovupsLoad)524 TEST_F(AssemblerX86Test, MovupsLoad) {
525 DriverStr(RepeatFA(&x86::X86Assembler::movups, "movups {mem}, %{reg}"), "movups_load");
526 }
527
TEST_F(AssemblerX86AVXTest,VMovupsLoad)528 TEST_F(AssemblerX86AVXTest, VMovupsLoad) {
529 DriverStr(RepeatFA(&x86::X86Assembler::vmovups, "vmovups {mem}, %{reg}"), "vmovups_load");
530 }
531
TEST_F(AssemblerX86AVXTest,MovupsLoad)532 TEST_F(AssemblerX86AVXTest, MovupsLoad) {
533 DriverStr(RepeatFA(&x86::X86Assembler::movups, "vmovups {mem}, %{reg}"), "avx_movups_load");
534 }
535
TEST_F(AssemblerX86Test,MovupsStore)536 TEST_F(AssemblerX86Test, MovupsStore) {
537 DriverStr(RepeatAF(&x86::X86Assembler::movups, "movups %{reg}, {mem}"), "movups_store");
538 }
539
TEST_F(AssemblerX86AVXTest,VMovupsStore)540 TEST_F(AssemblerX86AVXTest, VMovupsStore) {
541 DriverStr(RepeatAF(&x86::X86Assembler::vmovups, "vmovups %{reg}, {mem}"), "vmovups_store");
542 }
543
TEST_F(AssemblerX86AVXTest,MovupsStore)544 TEST_F(AssemblerX86AVXTest, MovupsStore) {
545 DriverStr(RepeatAF(&x86::X86Assembler::movups, "vmovups %{reg}, {mem}"), "avx_movups_store");
546 }
547
TEST_F(AssemblerX86Test,Movapd)548 TEST_F(AssemblerX86Test, Movapd) {
549 DriverStr(RepeatFF(&x86::X86Assembler::movapd, "movapd %{reg2}, %{reg1}"), "movapd");
550 }
551
TEST_F(AssemblerX86AVXTest,VMovapd)552 TEST_F(AssemblerX86AVXTest, VMovapd) {
553 DriverStr(RepeatFF(&x86::X86Assembler::vmovapd, "vmovapd %{reg2}, %{reg1}"), "vmovapd");
554 }
555
TEST_F(AssemblerX86AVXTest,Movapd)556 TEST_F(AssemblerX86AVXTest, Movapd) {
557 DriverStr(RepeatFF(&x86::X86Assembler::movapd, "vmovapd %{reg2}, %{reg1}"), "avx_movapd");
558 }
559
TEST_F(AssemblerX86Test,MovapdLoad)560 TEST_F(AssemblerX86Test, MovapdLoad) {
561 DriverStr(RepeatFA(&x86::X86Assembler::movapd, "movapd {mem}, %{reg}"), "movapd_load");
562 }
563
TEST_F(AssemblerX86AVXTest,VMovapdLoad)564 TEST_F(AssemblerX86AVXTest, VMovapdLoad) {
565 DriverStr(RepeatFA(&x86::X86Assembler::vmovapd, "vmovapd {mem}, %{reg}"), "vmovapd_load");
566 }
567
TEST_F(AssemblerX86AVXTest,MovapdLoad)568 TEST_F(AssemblerX86AVXTest, MovapdLoad) {
569 DriverStr(RepeatFA(&x86::X86Assembler::movapd, "vmovapd {mem}, %{reg}"), "avx_movapd_load");
570 }
571
TEST_F(AssemblerX86Test,MovapdStore)572 TEST_F(AssemblerX86Test, MovapdStore) {
573 DriverStr(RepeatAF(&x86::X86Assembler::movapd, "movapd %{reg}, {mem}"), "movapd_store");
574 }
575
TEST_F(AssemblerX86AVXTest,VMovapdStore)576 TEST_F(AssemblerX86AVXTest, VMovapdStore) {
577 DriverStr(RepeatAF(&x86::X86Assembler::vmovapd, "vmovapd %{reg}, {mem}"), "vmovapd_store");
578 }
579
TEST_F(AssemblerX86AVXTest,MovapdStore)580 TEST_F(AssemblerX86AVXTest, MovapdStore) {
581 DriverStr(RepeatAF(&x86::X86Assembler::movapd, "vmovapd %{reg}, {mem}"), "avx_movapd_store");
582 }
583
TEST_F(AssemblerX86Test,MovupdLoad)584 TEST_F(AssemblerX86Test, MovupdLoad) {
585 DriverStr(RepeatFA(&x86::X86Assembler::movupd, "movupd {mem}, %{reg}"), "movupd_load");
586 }
587
TEST_F(AssemblerX86AVXTest,VMovupdLoad)588 TEST_F(AssemblerX86AVXTest, VMovupdLoad) {
589 DriverStr(RepeatFA(&x86::X86Assembler::vmovupd, "vmovupd {mem}, %{reg}"), "vmovupd_load");
590 }
591
TEST_F(AssemblerX86AVXTest,MovupdLoad)592 TEST_F(AssemblerX86AVXTest, MovupdLoad) {
593 DriverStr(RepeatFA(&x86::X86Assembler::movupd, "vmovupd {mem}, %{reg}"), "avx_movupd_load");
594 }
595
TEST_F(AssemblerX86Test,MovupdStore)596 TEST_F(AssemblerX86Test, MovupdStore) {
597 DriverStr(RepeatAF(&x86::X86Assembler::movupd, "movupd %{reg}, {mem}"), "movupd_store");
598 }
599
TEST_F(AssemblerX86AVXTest,VMovupdStore)600 TEST_F(AssemblerX86AVXTest, VMovupdStore) {
601 DriverStr(RepeatAF(&x86::X86Assembler::vmovupd, "vmovupd %{reg}, {mem}"), "vmovupd_store");
602 }
603
TEST_F(AssemblerX86AVXTest,MovupdStore)604 TEST_F(AssemblerX86AVXTest, MovupdStore) {
605 DriverStr(RepeatAF(&x86::X86Assembler::movupd, "vmovupd %{reg}, {mem}"), "avx_movupd_store");
606 }
607
TEST_F(AssemblerX86Test,Movdqa)608 TEST_F(AssemblerX86Test, Movdqa) {
609 DriverStr(RepeatFF(&x86::X86Assembler::movdqa, "movdqa %{reg2}, %{reg1}"), "movdqa");
610 }
611
TEST_F(AssemblerX86AVXTest,VMovdqa)612 TEST_F(AssemblerX86AVXTest, VMovdqa) {
613 DriverStr(RepeatFF(&x86::X86Assembler::vmovdqa, "vmovdqa %{reg2}, %{reg1}"), "vmovdqa");
614 }
615
TEST_F(AssemblerX86AVXTest,Movdqa)616 TEST_F(AssemblerX86AVXTest, Movdqa) {
617 DriverStr(RepeatFF(&x86::X86Assembler::movdqa, "vmovdqa %{reg2}, %{reg1}"), "avx_movdqa");
618 }
619
TEST_F(AssemblerX86Test,MovdqaLoad)620 TEST_F(AssemblerX86Test, MovdqaLoad) {
621 DriverStr(RepeatFA(&x86::X86Assembler::movdqa, "movdqa {mem}, %{reg}"), "movdqa_load");
622 }
623
TEST_F(AssemblerX86AVXTest,VMovdqaLoad)624 TEST_F(AssemblerX86AVXTest, VMovdqaLoad) {
625 DriverStr(RepeatFA(&x86::X86Assembler::vmovdqa, "vmovdqa {mem}, %{reg}"), "vmovdqa_load");
626 }
627
TEST_F(AssemblerX86AVXTest,MovdqaLoad)628 TEST_F(AssemblerX86AVXTest, MovdqaLoad) {
629 DriverStr(RepeatFA(&x86::X86Assembler::movdqa, "vmovdqa {mem}, %{reg}"), "avx_movdqa_load");
630 }
631
TEST_F(AssemblerX86Test,MovdqaStore)632 TEST_F(AssemblerX86Test, MovdqaStore) {
633 DriverStr(RepeatAF(&x86::X86Assembler::movdqa, "movdqa %{reg}, {mem}"), "movdqa_store");
634 }
635
TEST_F(AssemblerX86AVXTest,VMovdqaStore)636 TEST_F(AssemblerX86AVXTest, VMovdqaStore) {
637 DriverStr(RepeatAF(&x86::X86Assembler::vmovdqa, "vmovdqa %{reg}, {mem}"), "vmovdqa_store");
638 }
639
TEST_F(AssemblerX86AVXTest,MovdqaStore)640 TEST_F(AssemblerX86AVXTest, MovdqaStore) {
641 DriverStr(RepeatAF(&x86::X86Assembler::movdqa, "vmovdqa %{reg}, {mem}"), "avx_movdqa_store");
642 }
643
TEST_F(AssemblerX86Test,MovdquLoad)644 TEST_F(AssemblerX86Test, MovdquLoad) {
645 DriverStr(RepeatFA(&x86::X86Assembler::movdqu, "movdqu {mem}, %{reg}"), "movdqu_load");
646 }
647
TEST_F(AssemblerX86AVXTest,VMovdquLoad)648 TEST_F(AssemblerX86AVXTest, VMovdquLoad) {
649 DriverStr(RepeatFA(&x86::X86Assembler::vmovdqu, "vmovdqu {mem}, %{reg}"), "vmovdqu_load");
650 }
651
TEST_F(AssemblerX86AVXTest,MovdquLoad)652 TEST_F(AssemblerX86AVXTest, MovdquLoad) {
653 DriverStr(RepeatFA(&x86::X86Assembler::movdqu, "vmovdqu {mem}, %{reg}"), "avx_movdqu_load");
654 }
655
TEST_F(AssemblerX86Test,MovdquStore)656 TEST_F(AssemblerX86Test, MovdquStore) {
657 DriverStr(RepeatAF(&x86::X86Assembler::movdqu, "movdqu %{reg}, {mem}"), "movdqu_store");
658 }
659
TEST_F(AssemblerX86AVXTest,VMovdquStore)660 TEST_F(AssemblerX86AVXTest, VMovdquStore) {
661 DriverStr(RepeatAF(&x86::X86Assembler::vmovdqu, "vmovdqu %{reg}, {mem}"), "vmovdqu_store");
662 }
663
TEST_F(AssemblerX86AVXTest,MovdquStore)664 TEST_F(AssemblerX86AVXTest, MovdquStore) {
665 DriverStr(RepeatAF(&x86::X86Assembler::movdqu, "vmovdqu %{reg}, {mem}"), "avx_movdqu_store");
666 }
667
TEST_F(AssemblerX86Test,AddPS)668 TEST_F(AssemblerX86Test, AddPS) {
669 DriverStr(RepeatFF(&x86::X86Assembler::addps, "addps %{reg2}, %{reg1}"), "addps");
670 }
671
TEST_F(AssemblerX86AVXTest,VAddPS)672 TEST_F(AssemblerX86AVXTest, VAddPS) {
673 DriverStr(RepeatFFF(&x86::X86Assembler::vaddps, "vaddps %{reg3}, %{reg2}, %{reg1}"), "vaddps");
674 }
675
TEST_F(AssemblerX86Test,AddPD)676 TEST_F(AssemblerX86Test, AddPD) {
677 DriverStr(RepeatFF(&x86::X86Assembler::addpd, "addpd %{reg2}, %{reg1}"), "addpd");
678 }
679
TEST_F(AssemblerX86AVXTest,VAddpd)680 TEST_F(AssemblerX86AVXTest, VAddpd) {
681 DriverStr(RepeatFFF(&x86::X86Assembler::vaddpd, "vaddpd %{reg3}, %{reg2}, %{reg1}"), "vaddpd");
682 }
683
TEST_F(AssemblerX86Test,SubPS)684 TEST_F(AssemblerX86Test, SubPS) {
685 DriverStr(RepeatFF(&x86::X86Assembler::subps, "subps %{reg2}, %{reg1}"), "subps");
686 }
687
TEST_F(AssemblerX86AVXTest,VSubPS)688 TEST_F(AssemblerX86AVXTest, VSubPS) {
689 DriverStr(RepeatFFF(&x86::X86Assembler::vsubps, "vsubps %{reg3},%{reg2}, %{reg1}"), "vsubps");
690 }
691
TEST_F(AssemblerX86Test,SubPD)692 TEST_F(AssemblerX86Test, SubPD) {
693 DriverStr(RepeatFF(&x86::X86Assembler::subpd, "subpd %{reg2}, %{reg1}"), "subpd");
694 }
695
TEST_F(AssemblerX86AVXTest,VSubPD)696 TEST_F(AssemblerX86AVXTest, VSubPD) {
697 DriverStr(RepeatFFF(&x86::X86Assembler::vsubpd, "vsubpd %{reg3}, %{reg2}, %{reg1}"), "vsubpd");
698 }
699
TEST_F(AssemblerX86Test,MulPS)700 TEST_F(AssemblerX86Test, MulPS) {
701 DriverStr(RepeatFF(&x86::X86Assembler::mulps, "mulps %{reg2}, %{reg1}"), "mulps");
702 }
703
TEST_F(AssemblerX86AVXTest,VMulPS)704 TEST_F(AssemblerX86AVXTest, VMulPS) {
705 DriverStr(RepeatFFF(&x86::X86Assembler::vmulps, "vmulps %{reg3}, %{reg2}, %{reg1}"), "vmulps");
706 }
707
TEST_F(AssemblerX86Test,MulPD)708 TEST_F(AssemblerX86Test, MulPD) {
709 DriverStr(RepeatFF(&x86::X86Assembler::mulpd, "mulpd %{reg2}, %{reg1}"), "mulpd");
710 }
711
TEST_F(AssemblerX86AVXTest,VMulPD)712 TEST_F(AssemblerX86AVXTest, VMulPD) {
713 DriverStr(RepeatFFF(&x86::X86Assembler::vmulpd, "vmulpd %{reg3}, %{reg2}, %{reg1}"), "vmulpd");
714 }
715
TEST_F(AssemblerX86Test,DivPS)716 TEST_F(AssemblerX86Test, DivPS) {
717 DriverStr(RepeatFF(&x86::X86Assembler::divps, "divps %{reg2}, %{reg1}"), "divps");
718 }
719
TEST_F(AssemblerX86AVXTest,VDivPS)720 TEST_F(AssemblerX86AVXTest, VDivPS) {
721 DriverStr(RepeatFFF(&x86::X86Assembler::vdivps, "vdivps %{reg3}, %{reg2}, %{reg1}"), "vdivps");
722 }
723
TEST_F(AssemblerX86Test,DivPD)724 TEST_F(AssemblerX86Test, DivPD) {
725 DriverStr(RepeatFF(&x86::X86Assembler::divpd, "divpd %{reg2}, %{reg1}"), "divpd");
726 }
727
TEST_F(AssemblerX86AVXTest,VDivPD)728 TEST_F(AssemblerX86AVXTest, VDivPD) {
729 DriverStr(RepeatFFF(&x86::X86Assembler::vdivpd, "vdivpd %{reg3}, %{reg2}, %{reg1}"), "vdivpd");
730 }
731
TEST_F(AssemblerX86Test,PAddB)732 TEST_F(AssemblerX86Test, PAddB) {
733 DriverStr(RepeatFF(&x86::X86Assembler::paddb, "paddb %{reg2}, %{reg1}"), "paddb");
734 }
735
TEST_F(AssemblerX86AVXTest,VPaddB)736 TEST_F(AssemblerX86AVXTest, VPaddB) {
737 DriverStr(RepeatFFF(&x86::X86Assembler::vpaddb, "vpaddb %{reg3}, %{reg2}, %{reg1}"), "vpaddb");
738 }
739
TEST_F(AssemblerX86Test,PSubB)740 TEST_F(AssemblerX86Test, PSubB) {
741 DriverStr(RepeatFF(&x86::X86Assembler::psubb, "psubb %{reg2}, %{reg1}"), "psubb");
742 }
743
TEST_F(AssemblerX86AVXTest,VPsubB)744 TEST_F(AssemblerX86AVXTest, VPsubB) {
745 DriverStr(RepeatFFF(&x86::X86Assembler::vpsubb, "vpsubb %{reg3},%{reg2}, %{reg1}"), "vpsubb");
746 }
747
TEST_F(AssemblerX86Test,PAddW)748 TEST_F(AssemblerX86Test, PAddW) {
749 DriverStr(RepeatFF(&x86::X86Assembler::paddw, "paddw %{reg2}, %{reg1}"), "paddw");
750 }
751
TEST_F(AssemblerX86AVXTest,VPaddW)752 TEST_F(AssemblerX86AVXTest, VPaddW) {
753 DriverStr(RepeatFFF(&x86::X86Assembler::vpaddw, "vpaddw %{reg3}, %{reg2}, %{reg1}"), "vpaddw");
754 }
755
TEST_F(AssemblerX86Test,PSubW)756 TEST_F(AssemblerX86Test, PSubW) {
757 DriverStr(RepeatFF(&x86::X86Assembler::psubw, "psubw %{reg2}, %{reg1}"), "psubw");
758 }
759
TEST_F(AssemblerX86AVXTest,VPsubW)760 TEST_F(AssemblerX86AVXTest, VPsubW) {
761 DriverStr(RepeatFFF(&x86::X86Assembler::vpsubw, "vpsubw %{reg3}, %{reg2}, %{reg1}"), "vpsubw");
762 }
763
TEST_F(AssemblerX86Test,PMullW)764 TEST_F(AssemblerX86Test, PMullW) {
765 DriverStr(RepeatFF(&x86::X86Assembler::pmullw, "pmullw %{reg2}, %{reg1}"), "pmullw");
766 }
767
TEST_F(AssemblerX86AVXTest,VPMullW)768 TEST_F(AssemblerX86AVXTest, VPMullW) {
769 DriverStr(RepeatFFF(&x86::X86Assembler::vpmullw, "vpmullw %{reg3}, %{reg2}, %{reg1}"), "vpmullw");
770 }
771
TEST_F(AssemblerX86Test,PAddD)772 TEST_F(AssemblerX86Test, PAddD) {
773 DriverStr(RepeatFF(&x86::X86Assembler::paddd, "paddd %{reg2}, %{reg1}"), "paddd");
774 }
775
TEST_F(AssemblerX86AVXTest,VPaddD)776 TEST_F(AssemblerX86AVXTest, VPaddD) {
777 DriverStr(RepeatFFF(&x86::X86Assembler::vpaddd, "vpaddd %{reg3}, %{reg2}, %{reg1}"), "vpaddd");
778 }
779
TEST_F(AssemblerX86Test,PSubD)780 TEST_F(AssemblerX86Test, PSubD) {
781 DriverStr(RepeatFF(&x86::X86Assembler::psubd, "psubd %{reg2}, %{reg1}"), "psubd");
782 }
783
TEST_F(AssemblerX86AVXTest,VPsubD)784 TEST_F(AssemblerX86AVXTest, VPsubD) {
785 DriverStr(RepeatFFF(&x86::X86Assembler::vpsubd, "vpsubd %{reg3}, %{reg2}, %{reg1}"), "vpsubd");
786 }
787
TEST_F(AssemblerX86Test,PMullD)788 TEST_F(AssemblerX86Test, PMullD) {
789 DriverStr(RepeatFF(&x86::X86Assembler::pmulld, "pmulld %{reg2}, %{reg1}"), "pmulld");
790 }
791
TEST_F(AssemblerX86AVXTest,VPMullD)792 TEST_F(AssemblerX86AVXTest, VPMullD) {
793 DriverStr(RepeatFFF(&x86::X86Assembler::vpmulld, "vpmulld %{reg3}, %{reg2}, %{reg1}"), "vpmulld");
794 }
795
TEST_F(AssemblerX86Test,PAddQ)796 TEST_F(AssemblerX86Test, PAddQ) {
797 DriverStr(RepeatFF(&x86::X86Assembler::paddq, "paddq %{reg2}, %{reg1}"), "paddq");
798 }
799
TEST_F(AssemblerX86AVXTest,VPaddQ)800 TEST_F(AssemblerX86AVXTest, VPaddQ) {
801 DriverStr(RepeatFFF(&x86::X86Assembler::vpaddq, "vpaddq %{reg3}, %{reg2}, %{reg1}"), "vpaddq");
802 }
803
TEST_F(AssemblerX86Test,PSubQ)804 TEST_F(AssemblerX86Test, PSubQ) {
805 DriverStr(RepeatFF(&x86::X86Assembler::psubq, "psubq %{reg2}, %{reg1}"), "psubq");
806 }
807
TEST_F(AssemblerX86AVXTest,VPsubQ)808 TEST_F(AssemblerX86AVXTest, VPsubQ) {
809 DriverStr(RepeatFFF(&x86::X86Assembler::vpsubq, "vpsubq %{reg3}, %{reg2}, %{reg1}"), "vpsubq");
810 }
811
TEST_F(AssemblerX86Test,PAddUSB)812 TEST_F(AssemblerX86Test, PAddUSB) {
813 DriverStr(RepeatFF(&x86::X86Assembler::paddusb, "paddusb %{reg2}, %{reg1}"), "paddusb");
814 }
815
TEST_F(AssemblerX86Test,PAddSB)816 TEST_F(AssemblerX86Test, PAddSB) {
817 DriverStr(RepeatFF(&x86::X86Assembler::paddsb, "paddsb %{reg2}, %{reg1}"), "paddsb");
818 }
819
TEST_F(AssemblerX86Test,PAddUSW)820 TEST_F(AssemblerX86Test, PAddUSW) {
821 DriverStr(RepeatFF(&x86::X86Assembler::paddusw, "paddusw %{reg2}, %{reg1}"), "paddusw");
822 }
823
TEST_F(AssemblerX86Test,PAddSW)824 TEST_F(AssemblerX86Test, PAddSW) {
825 DriverStr(RepeatFF(&x86::X86Assembler::psubsw, "psubsw %{reg2}, %{reg1}"), "psubsw");
826 }
827
TEST_F(AssemblerX86Test,PSubUSB)828 TEST_F(AssemblerX86Test, PSubUSB) {
829 DriverStr(RepeatFF(&x86::X86Assembler::psubusb, "psubusb %{reg2}, %{reg1}"), "psubusb");
830 }
831
TEST_F(AssemblerX86Test,PSubSB)832 TEST_F(AssemblerX86Test, PSubSB) {
833 DriverStr(RepeatFF(&x86::X86Assembler::psubsb, "psubsb %{reg2}, %{reg1}"), "psubsb");
834 }
835
TEST_F(AssemblerX86Test,PSubUSW)836 TEST_F(AssemblerX86Test, PSubUSW) {
837 DriverStr(RepeatFF(&x86::X86Assembler::psubusw, "psubusw %{reg2}, %{reg1}"), "psubusw");
838 }
839
TEST_F(AssemblerX86Test,PSubSW)840 TEST_F(AssemblerX86Test, PSubSW) {
841 DriverStr(RepeatFF(&x86::X86Assembler::psubsw, "psubsw %{reg2}, %{reg1}"), "psubsw");
842 }
843
TEST_F(AssemblerX86Test,XorPD)844 TEST_F(AssemblerX86Test, XorPD) {
845 DriverStr(RepeatFF(&x86::X86Assembler::xorpd, "xorpd %{reg2}, %{reg1}"), "xorpd");
846 }
847
TEST_F(AssemblerX86Test,XorPS)848 TEST_F(AssemblerX86Test, XorPS) {
849 DriverStr(RepeatFF(&x86::X86Assembler::xorps, "xorps %{reg2}, %{reg1}"), "xorps");
850 }
851
TEST_F(AssemblerX86Test,PXor)852 TEST_F(AssemblerX86Test, PXor) {
853 DriverStr(RepeatFF(&x86::X86Assembler::pxor, "pxor %{reg2}, %{reg1}"), "pxor");
854 }
855
TEST_F(AssemblerX86AVXTest,VPXor)856 TEST_F(AssemblerX86AVXTest, VPXor) {
857 DriverStr(RepeatFFF(&x86::X86Assembler::vpxor, "vpxor %{reg3}, %{reg2}, %{reg1}"), "vpxor");
858 }
859
TEST_F(AssemblerX86AVXTest,VXorPS)860 TEST_F(AssemblerX86AVXTest, VXorPS) {
861 DriverStr(RepeatFFF(&x86::X86Assembler::vxorps, "vxorps %{reg3}, %{reg2}, %{reg1}"), "vxorps");
862 }
863
TEST_F(AssemblerX86AVXTest,VXorPD)864 TEST_F(AssemblerX86AVXTest, VXorPD) {
865 DriverStr(RepeatFFF(&x86::X86Assembler::vxorpd, "vxorpd %{reg3}, %{reg2}, %{reg1}"), "vxorpd");
866 }
867
TEST_F(AssemblerX86Test,AndPD)868 TEST_F(AssemblerX86Test, AndPD) {
869 DriverStr(RepeatFF(&x86::X86Assembler::andpd, "andpd %{reg2}, %{reg1}"), "andpd");
870 }
871
TEST_F(AssemblerX86Test,AndPS)872 TEST_F(AssemblerX86Test, AndPS) {
873 DriverStr(RepeatFF(&x86::X86Assembler::andps, "andps %{reg2}, %{reg1}"), "andps");
874 }
875
TEST_F(AssemblerX86Test,PAnd)876 TEST_F(AssemblerX86Test, PAnd) {
877 DriverStr(RepeatFF(&x86::X86Assembler::pand, "pand %{reg2}, %{reg1}"), "pand");
878 }
879
TEST_F(AssemblerX86AVXTest,VPAnd)880 TEST_F(AssemblerX86AVXTest, VPAnd) {
881 DriverStr(RepeatFFF(&x86::X86Assembler::vpand, "vpand %{reg3}, %{reg2}, %{reg1}"), "vpand");
882 }
883
TEST_F(AssemblerX86AVXTest,VAndPS)884 TEST_F(AssemblerX86AVXTest, VAndPS) {
885 DriverStr(RepeatFFF(&x86::X86Assembler::vandps, "vandps %{reg3}, %{reg2}, %{reg1}"), "vandps");
886 }
887
TEST_F(AssemblerX86AVXTest,VAndPD)888 TEST_F(AssemblerX86AVXTest, VAndPD) {
889 DriverStr(RepeatFFF(&x86::X86Assembler::vandpd, "vandpd %{reg3}, %{reg2}, %{reg1}"), "vandpd");
890 }
891
TEST_F(AssemblerX86Test,Andn)892 TEST_F(AssemblerX86Test, Andn) {
893 DriverStr(RepeatRRR(&x86::X86Assembler::andn, "andn %{reg3}, %{reg2}, %{reg1}"), "andn");
894 }
895
TEST_F(AssemblerX86Test,AndnPD)896 TEST_F(AssemblerX86Test, AndnPD) {
897 DriverStr(RepeatFF(&x86::X86Assembler::andnpd, "andnpd %{reg2}, %{reg1}"), "andnpd");
898 }
899
TEST_F(AssemblerX86Test,AndnPS)900 TEST_F(AssemblerX86Test, AndnPS) {
901 DriverStr(RepeatFF(&x86::X86Assembler::andnps, "andnps %{reg2}, %{reg1}"), "andnps");
902 }
903
TEST_F(AssemblerX86Test,PAndn)904 TEST_F(AssemblerX86Test, PAndn) {
905 DriverStr(RepeatFF(&x86::X86Assembler::pandn, "pandn %{reg2}, %{reg1}"), "pandn");
906 }
907
TEST_F(AssemblerX86AVXTest,VPAndn)908 TEST_F(AssemblerX86AVXTest, VPAndn) {
909 DriverStr(RepeatFFF(&x86::X86Assembler::vpandn, "vpandn %{reg3}, %{reg2}, %{reg1}"), "vpandn");
910 }
911
TEST_F(AssemblerX86AVXTest,VAndnPS)912 TEST_F(AssemblerX86AVXTest, VAndnPS) {
913 DriverStr(RepeatFFF(&x86::X86Assembler::vandnps, "vandnps %{reg3}, %{reg2}, %{reg1}"), "vandnps");
914 }
915
TEST_F(AssemblerX86AVXTest,VAndnPD)916 TEST_F(AssemblerX86AVXTest, VAndnPD) {
917 DriverStr(RepeatFFF(&x86::X86Assembler::vandnpd, "vandnpd %{reg3}, %{reg2}, %{reg1}"), "vandnpd");
918 }
919
TEST_F(AssemblerX86Test,OrPD)920 TEST_F(AssemblerX86Test, OrPD) {
921 DriverStr(RepeatFF(&x86::X86Assembler::orpd, "orpd %{reg2}, %{reg1}"), "orpd");
922 }
923
TEST_F(AssemblerX86Test,OrPS)924 TEST_F(AssemblerX86Test, OrPS) {
925 DriverStr(RepeatFF(&x86::X86Assembler::orps, "orps %{reg2}, %{reg1}"), "orps");
926 }
927
TEST_F(AssemblerX86Test,POr)928 TEST_F(AssemblerX86Test, POr) {
929 DriverStr(RepeatFF(&x86::X86Assembler::por, "por %{reg2}, %{reg1}"), "por");
930 }
931
TEST_F(AssemblerX86AVXTest,VPor)932 TEST_F(AssemblerX86AVXTest, VPor) {
933 DriverStr(RepeatFFF(&x86::X86Assembler::vpor, "vpor %{reg3}, %{reg2}, %{reg1}"), "vpor");
934 }
935
TEST_F(AssemblerX86AVXTest,VorPS)936 TEST_F(AssemblerX86AVXTest, VorPS) {
937 DriverStr(RepeatFFF(&x86::X86Assembler::vorps, "vorps %{reg3}, %{reg2}, %{reg1}"), "vorps");
938 }
939
TEST_F(AssemblerX86AVXTest,VorPD)940 TEST_F(AssemblerX86AVXTest, VorPD) {
941 DriverStr(RepeatFFF(&x86::X86Assembler::vorpd, "vorpd %{reg3}, %{reg2}, %{reg1}"), "vorpd");
942 }
943
TEST_F(AssemblerX86Test,PAvgB)944 TEST_F(AssemblerX86Test, PAvgB) {
945 DriverStr(RepeatFF(&x86::X86Assembler::pavgb, "pavgb %{reg2}, %{reg1}"), "pavgb");
946 }
947
TEST_F(AssemblerX86Test,PAvgW)948 TEST_F(AssemblerX86Test, PAvgW) {
949 DriverStr(RepeatFF(&x86::X86Assembler::pavgw, "pavgw %{reg2}, %{reg1}"), "pavgw");
950 }
951
TEST_F(AssemblerX86Test,PSadBW)952 TEST_F(AssemblerX86Test, PSadBW) {
953 DriverStr(RepeatFF(&x86::X86Assembler::psadbw, "psadbw %{reg2}, %{reg1}"), "psadbw");
954 }
955
TEST_F(AssemblerX86Test,PMAddWD)956 TEST_F(AssemblerX86Test, PMAddWD) {
957 DriverStr(RepeatFF(&x86::X86Assembler::pmaddwd, "pmaddwd %{reg2}, %{reg1}"), "pmaddwd");
958 }
959
TEST_F(AssemblerX86AVXTest,VPMAddWD)960 TEST_F(AssemblerX86AVXTest, VPMAddWD) {
961 DriverStr(
962 RepeatFFF(&x86::X86Assembler::vpmaddwd, "vpmaddwd %{reg3}, %{reg2}, %{reg1}"), "vpmaddwd");
963 }
964
TEST_F(AssemblerX86Test,PHAddW)965 TEST_F(AssemblerX86Test, PHAddW) {
966 DriverStr(RepeatFF(&x86::X86Assembler::phaddw, "phaddw %{reg2}, %{reg1}"), "phaddw");
967 }
968
TEST_F(AssemblerX86Test,PHAddD)969 TEST_F(AssemblerX86Test, PHAddD) {
970 DriverStr(RepeatFF(&x86::X86Assembler::phaddd, "phaddd %{reg2}, %{reg1}"), "phaddd");
971 }
972
TEST_F(AssemblerX86Test,HAddPS)973 TEST_F(AssemblerX86Test, HAddPS) {
974 DriverStr(RepeatFF(&x86::X86Assembler::haddps, "haddps %{reg2}, %{reg1}"), "haddps");
975 }
976
TEST_F(AssemblerX86Test,HAddPD)977 TEST_F(AssemblerX86Test, HAddPD) {
978 DriverStr(RepeatFF(&x86::X86Assembler::haddpd, "haddpd %{reg2}, %{reg1}"), "haddpd");
979 }
980
TEST_F(AssemblerX86Test,PHSubW)981 TEST_F(AssemblerX86Test, PHSubW) {
982 DriverStr(RepeatFF(&x86::X86Assembler::phsubw, "phsubw %{reg2}, %{reg1}"), "phsubw");
983 }
984
TEST_F(AssemblerX86Test,PHSubD)985 TEST_F(AssemblerX86Test, PHSubD) {
986 DriverStr(RepeatFF(&x86::X86Assembler::phsubd, "phsubd %{reg2}, %{reg1}"), "phsubd");
987 }
988
TEST_F(AssemblerX86Test,HSubPS)989 TEST_F(AssemblerX86Test, HSubPS) {
990 DriverStr(RepeatFF(&x86::X86Assembler::hsubps, "hsubps %{reg2}, %{reg1}"), "hsubps");
991 }
992
TEST_F(AssemblerX86Test,HSubPD)993 TEST_F(AssemblerX86Test, HSubPD) {
994 DriverStr(RepeatFF(&x86::X86Assembler::hsubpd, "hsubpd %{reg2}, %{reg1}"), "hsubpd");
995 }
996
TEST_F(AssemblerX86Test,PMinSB)997 TEST_F(AssemblerX86Test, PMinSB) {
998 DriverStr(RepeatFF(&x86::X86Assembler::pminsb, "pminsb %{reg2}, %{reg1}"), "pminsb");
999 }
1000
TEST_F(AssemblerX86Test,PMaxSB)1001 TEST_F(AssemblerX86Test, PMaxSB) {
1002 DriverStr(RepeatFF(&x86::X86Assembler::pmaxsb, "pmaxsb %{reg2}, %{reg1}"), "pmaxsb");
1003 }
1004
TEST_F(AssemblerX86Test,PMinSW)1005 TEST_F(AssemblerX86Test, PMinSW) {
1006 DriverStr(RepeatFF(&x86::X86Assembler::pminsw, "pminsw %{reg2}, %{reg1}"), "pminsw");
1007 }
1008
TEST_F(AssemblerX86Test,PMaxSW)1009 TEST_F(AssemblerX86Test, PMaxSW) {
1010 DriverStr(RepeatFF(&x86::X86Assembler::pmaxsw, "pmaxsw %{reg2}, %{reg1}"), "pmaxsw");
1011 }
1012
TEST_F(AssemblerX86Test,PMinSD)1013 TEST_F(AssemblerX86Test, PMinSD) {
1014 DriverStr(RepeatFF(&x86::X86Assembler::pminsd, "pminsd %{reg2}, %{reg1}"), "pminsd");
1015 }
1016
TEST_F(AssemblerX86Test,PMaxSD)1017 TEST_F(AssemblerX86Test, PMaxSD) {
1018 DriverStr(RepeatFF(&x86::X86Assembler::pmaxsd, "pmaxsd %{reg2}, %{reg1}"), "pmaxsd");
1019 }
1020
TEST_F(AssemblerX86Test,PMinUB)1021 TEST_F(AssemblerX86Test, PMinUB) {
1022 DriverStr(RepeatFF(&x86::X86Assembler::pminub, "pminub %{reg2}, %{reg1}"), "pminub");
1023 }
1024
TEST_F(AssemblerX86Test,PMaxUB)1025 TEST_F(AssemblerX86Test, PMaxUB) {
1026 DriverStr(RepeatFF(&x86::X86Assembler::pmaxub, "pmaxub %{reg2}, %{reg1}"), "pmaxub");
1027 }
1028
TEST_F(AssemblerX86Test,PMinUW)1029 TEST_F(AssemblerX86Test, PMinUW) {
1030 DriverStr(RepeatFF(&x86::X86Assembler::pminuw, "pminuw %{reg2}, %{reg1}"), "pminuw");
1031 }
1032
TEST_F(AssemblerX86Test,PMaxUW)1033 TEST_F(AssemblerX86Test, PMaxUW) {
1034 DriverStr(RepeatFF(&x86::X86Assembler::pmaxuw, "pmaxuw %{reg2}, %{reg1}"), "pmaxuw");
1035 }
1036
TEST_F(AssemblerX86Test,PMinUD)1037 TEST_F(AssemblerX86Test, PMinUD) {
1038 DriverStr(RepeatFF(&x86::X86Assembler::pminud, "pminud %{reg2}, %{reg1}"), "pminud");
1039 }
1040
TEST_F(AssemblerX86Test,PMaxUD)1041 TEST_F(AssemblerX86Test, PMaxUD) {
1042 DriverStr(RepeatFF(&x86::X86Assembler::pmaxud, "pmaxud %{reg2}, %{reg1}"), "pmaxud");
1043 }
1044
TEST_F(AssemblerX86Test,MinPS)1045 TEST_F(AssemblerX86Test, MinPS) {
1046 DriverStr(RepeatFF(&x86::X86Assembler::minps, "minps %{reg2}, %{reg1}"), "minps");
1047 }
1048
TEST_F(AssemblerX86Test,MaxPS)1049 TEST_F(AssemblerX86Test, MaxPS) {
1050 DriverStr(RepeatFF(&x86::X86Assembler::maxps, "maxps %{reg2}, %{reg1}"), "maxps");
1051 }
1052
TEST_F(AssemblerX86Test,MinPD)1053 TEST_F(AssemblerX86Test, MinPD) {
1054 DriverStr(RepeatFF(&x86::X86Assembler::minpd, "minpd %{reg2}, %{reg1}"), "minpd");
1055 }
1056
TEST_F(AssemblerX86Test,MaxPD)1057 TEST_F(AssemblerX86Test, MaxPD) {
1058 DriverStr(RepeatFF(&x86::X86Assembler::maxpd, "maxpd %{reg2}, %{reg1}"), "maxpd");
1059 }
1060
TEST_F(AssemblerX86Test,PCmpeqB)1061 TEST_F(AssemblerX86Test, PCmpeqB) {
1062 DriverStr(RepeatFF(&x86::X86Assembler::pcmpeqb, "pcmpeqb %{reg2}, %{reg1}"), "cmpeqb");
1063 }
1064
TEST_F(AssemblerX86Test,PCmpeqW)1065 TEST_F(AssemblerX86Test, PCmpeqW) {
1066 DriverStr(RepeatFF(&x86::X86Assembler::pcmpeqw, "pcmpeqw %{reg2}, %{reg1}"), "cmpeqw");
1067 }
1068
TEST_F(AssemblerX86Test,PCmpeqD)1069 TEST_F(AssemblerX86Test, PCmpeqD) {
1070 DriverStr(RepeatFF(&x86::X86Assembler::pcmpeqd, "pcmpeqd %{reg2}, %{reg1}"), "cmpeqd");
1071 }
1072
TEST_F(AssemblerX86Test,PCmpeqQ)1073 TEST_F(AssemblerX86Test, PCmpeqQ) {
1074 DriverStr(RepeatFF(&x86::X86Assembler::pcmpeqq, "pcmpeqq %{reg2}, %{reg1}"), "cmpeqq");
1075 }
1076
TEST_F(AssemblerX86Test,PCmpgtB)1077 TEST_F(AssemblerX86Test, PCmpgtB) {
1078 DriverStr(RepeatFF(&x86::X86Assembler::pcmpgtb, "pcmpgtb %{reg2}, %{reg1}"), "cmpgtb");
1079 }
1080
TEST_F(AssemblerX86Test,PCmpgtW)1081 TEST_F(AssemblerX86Test, PCmpgtW) {
1082 DriverStr(RepeatFF(&x86::X86Assembler::pcmpgtw, "pcmpgtw %{reg2}, %{reg1}"), "cmpgtw");
1083 }
1084
TEST_F(AssemblerX86Test,PCmpgtD)1085 TEST_F(AssemblerX86Test, PCmpgtD) {
1086 DriverStr(RepeatFF(&x86::X86Assembler::pcmpgtd, "pcmpgtd %{reg2}, %{reg1}"), "cmpgtd");
1087 }
1088
TEST_F(AssemblerX86Test,PCmpgtQ)1089 TEST_F(AssemblerX86Test, PCmpgtQ) {
1090 DriverStr(RepeatFF(&x86::X86Assembler::pcmpgtq, "pcmpgtq %{reg2}, %{reg1}"), "cmpgtq");
1091 }
1092
TEST_F(AssemblerX86Test,ShufPS)1093 TEST_F(AssemblerX86Test, ShufPS) {
1094 DriverStr(RepeatFFI(&x86::X86Assembler::shufps, 1, "shufps ${imm}, %{reg2}, %{reg1}"), "shufps");
1095 }
1096
TEST_F(AssemblerX86Test,ShufPD)1097 TEST_F(AssemblerX86Test, ShufPD) {
1098 DriverStr(RepeatFFI(&x86::X86Assembler::shufpd, 1, "shufpd ${imm}, %{reg2}, %{reg1}"), "shufpd");
1099 }
1100
TEST_F(AssemblerX86Test,PShufD)1101 TEST_F(AssemblerX86Test, PShufD) {
1102 DriverStr(RepeatFFI(&x86::X86Assembler::pshufd, 1, "pshufd ${imm}, %{reg2}, %{reg1}"), "pshufd");
1103 }
1104
TEST_F(AssemblerX86Test,Punpcklbw)1105 TEST_F(AssemblerX86Test, Punpcklbw) {
1106 DriverStr(RepeatFF(&x86::X86Assembler::punpcklbw, "punpcklbw %{reg2}, %{reg1}"), "punpcklbw");
1107 }
1108
TEST_F(AssemblerX86Test,Punpcklwd)1109 TEST_F(AssemblerX86Test, Punpcklwd) {
1110 DriverStr(RepeatFF(&x86::X86Assembler::punpcklwd, "punpcklwd %{reg2}, %{reg1}"), "punpcklwd");
1111 }
1112
TEST_F(AssemblerX86Test,Punpckldq)1113 TEST_F(AssemblerX86Test, Punpckldq) {
1114 DriverStr(RepeatFF(&x86::X86Assembler::punpckldq, "punpckldq %{reg2}, %{reg1}"), "punpckldq");
1115 }
1116
TEST_F(AssemblerX86Test,Punpcklqdq)1117 TEST_F(AssemblerX86Test, Punpcklqdq) {
1118 DriverStr(RepeatFF(&x86::X86Assembler::punpcklqdq, "punpcklqdq %{reg2}, %{reg1}"), "punpcklqdq");
1119 }
1120
TEST_F(AssemblerX86Test,Punpckhbw)1121 TEST_F(AssemblerX86Test, Punpckhbw) {
1122 DriverStr(RepeatFF(&x86::X86Assembler::punpckhbw, "punpckhbw %{reg2}, %{reg1}"), "punpckhbw");
1123 }
1124
TEST_F(AssemblerX86Test,Punpckhwd)1125 TEST_F(AssemblerX86Test, Punpckhwd) {
1126 DriverStr(RepeatFF(&x86::X86Assembler::punpckhwd, "punpckhwd %{reg2}, %{reg1}"), "punpckhwd");
1127 }
1128
TEST_F(AssemblerX86Test,Punpckhdq)1129 TEST_F(AssemblerX86Test, Punpckhdq) {
1130 DriverStr(RepeatFF(&x86::X86Assembler::punpckhdq, "punpckhdq %{reg2}, %{reg1}"), "punpckhdq");
1131 }
1132
TEST_F(AssemblerX86Test,Punpckhqdq)1133 TEST_F(AssemblerX86Test, Punpckhqdq) {
1134 DriverStr(RepeatFF(&x86::X86Assembler::punpckhqdq, "punpckhqdq %{reg2}, %{reg1}"), "punpckhqdq");
1135 }
1136
TEST_F(AssemblerX86Test,psllw)1137 TEST_F(AssemblerX86Test, psllw) {
1138 GetAssembler()->psllw(x86::XMM0, CreateImmediate(16));
1139 DriverStr("psllw $0x10, %xmm0\n", "psllwi");
1140 }
1141
TEST_F(AssemblerX86Test,pslld)1142 TEST_F(AssemblerX86Test, pslld) {
1143 GetAssembler()->pslld(x86::XMM0, CreateImmediate(16));
1144 DriverStr("pslld $0x10, %xmm0\n", "pslldi");
1145 }
1146
TEST_F(AssemblerX86Test,psllq)1147 TEST_F(AssemblerX86Test, psllq) {
1148 GetAssembler()->psllq(x86::XMM0, CreateImmediate(16));
1149 DriverStr("psllq $0x10, %xmm0\n", "psllqi");
1150 }
1151
TEST_F(AssemblerX86Test,psraw)1152 TEST_F(AssemblerX86Test, psraw) {
1153 GetAssembler()->psraw(x86::XMM0, CreateImmediate(16));
1154 DriverStr("psraw $0x10, %xmm0\n", "psrawi");
1155 }
1156
TEST_F(AssemblerX86Test,psrad)1157 TEST_F(AssemblerX86Test, psrad) {
1158 GetAssembler()->psrad(x86::XMM0, CreateImmediate(16));
1159 DriverStr("psrad $0x10, %xmm0\n", "psradi");
1160 }
1161
TEST_F(AssemblerX86Test,psrlw)1162 TEST_F(AssemblerX86Test, psrlw) {
1163 GetAssembler()->psrlw(x86::XMM0, CreateImmediate(16));
1164 DriverStr("psrlw $0x10, %xmm0\n", "psrlwi");
1165 }
1166
TEST_F(AssemblerX86Test,psrld)1167 TEST_F(AssemblerX86Test, psrld) {
1168 GetAssembler()->psrld(x86::XMM0, CreateImmediate(16));
1169 DriverStr("psrld $0x10, %xmm0\n", "psrldi");
1170 }
1171
TEST_F(AssemblerX86Test,psrlq)1172 TEST_F(AssemblerX86Test, psrlq) {
1173 GetAssembler()->psrlq(x86::XMM0, CreateImmediate(16));
1174 DriverStr("psrlq $0x10, %xmm0\n", "psrlqi");
1175 }
1176
TEST_F(AssemblerX86Test,psrldq)1177 TEST_F(AssemblerX86Test, psrldq) {
1178 GetAssembler()->psrldq(x86::XMM0, CreateImmediate(16));
1179 DriverStr("psrldq $0x10, %xmm0\n", "psrldqi");
1180 }
1181
TEST_F(AssemblerX86Test,Jecxz)1182 TEST_F(AssemblerX86Test, Jecxz) {
1183 x86::NearLabel target;
1184 GetAssembler()->jecxz(&target);
1185 GetAssembler()->addl(x86::EDI, x86::Address(x86::ESP, 4));
1186 GetAssembler()->Bind(&target);
1187 const char* expected =
1188 "jecxz 1f\n"
1189 "addl 4(%ESP),%EDI\n"
1190 "1:\n";
1191 DriverStr(expected, "jecxz");
1192 }
1193
TEST_F(AssemblerX86Test,NearLabel)1194 TEST_F(AssemblerX86Test, NearLabel) {
1195 // Test both forward and backward branches.
1196 x86::NearLabel start, target;
1197 GetAssembler()->Bind(&start);
1198 GetAssembler()->j(x86::kEqual, &target);
1199 GetAssembler()->jmp(&target);
1200 GetAssembler()->jecxz(&target);
1201 GetAssembler()->addl(x86::EDI, x86::Address(x86::ESP, 4));
1202 GetAssembler()->Bind(&target);
1203 GetAssembler()->j(x86::kNotEqual, &start);
1204 GetAssembler()->jmp(&start);
1205 const char* expected =
1206 "1: je 2f\n"
1207 "jmp 2f\n"
1208 "jecxz 2f\n"
1209 "addl 4(%ESP),%EDI\n"
1210 "2: jne 1b\n"
1211 "jmp 1b\n";
1212 DriverStr(expected, "near_label");
1213 }
1214
TEST_F(AssemblerX86Test,Cmpb)1215 TEST_F(AssemblerX86Test, Cmpb) {
1216 DriverStr(RepeatAI(&x86::X86Assembler::cmpb,
1217 /*imm_bytes*/ 1U,
1218 "cmpb ${imm}, {mem}"), "cmpb");
1219 }
1220
TEST_F(AssemblerX86Test,Cmpw)1221 TEST_F(AssemblerX86Test, Cmpw) {
1222 DriverStr(RepeatAI(&x86::X86Assembler::cmpw, /*imm_bytes*/ 2U, "cmpw ${imm}, {mem}"), "cmpw");
1223 }
1224
TEST_F(AssemblerX86Test,Idiv)1225 TEST_F(AssemblerX86Test, Idiv) {
1226 DriverStr(RepeatR(&x86::X86Assembler::idivl, "idivl %{reg}"), "idivl");
1227 }
1228
TEST_F(AssemblerX86Test,Div)1229 TEST_F(AssemblerX86Test, Div) {
1230 DriverStr(RepeatR(&x86::X86Assembler::divl, "divl %{reg}"), "divl");
1231 }
1232
TEST_F(AssemblerX86Test,Negl)1233 TEST_F(AssemblerX86Test, Negl) {
1234 DriverStr(RepeatR(&x86::X86Assembler::negl, "negl %{reg}"), "negl");
1235 }
1236
TEST_F(AssemblerX86Test,Notl)1237 TEST_F(AssemblerX86Test, Notl) {
1238 DriverStr(RepeatR(&x86::X86Assembler::notl, "notl %{reg}"), "notl");
1239 }
1240
1241 } // namespace art
1242