Lines Matching refs:as

133   CodeEmitter as(&code);  in LabelTest()  local
135 as.Call(bit_cast<const void*>(&Callee)); in LabelTest()
136 as.Jmp(skip); in LabelTest()
137 as.Movl(Assembler::eax, 2); in LabelTest()
138 as.Bind(&skip); in LabelTest()
139 as.Addl(Assembler::eax, 8); in LabelTest()
140 as.Jmp(skip2); in LabelTest()
141 as.Bind(&back); in LabelTest()
142 as.Addl(Assembler::eax, 12); in LabelTest()
143 as.Jmp(end); in LabelTest()
144 as.Bind(&skip2); in LabelTest()
145 as.Jmp(back); in LabelTest()
146 as.Bind(&end); in LabelTest()
147 as.Ret(); in LabelTest()
148 as.Finalize(); in LabelTest()
158 CodeEmitter as(&code); in CondTest1() local
159 as.Movl(Assembler::eax, 0xcccccccc); in CondTest1()
160 as.Movl(Assembler::edx, {.base = Assembler::esp, .disp = 4}); // arg1. in CondTest1()
161 as.Movl(Assembler::ecx, {.base = Assembler::esp, .disp = 8}); // arg2. in CondTest1()
162 as.Cmpl(Assembler::edx, Assembler::ecx); in CondTest1()
163 as.Setcc(Assembler::Condition::kEqual, Assembler::eax); in CondTest1()
164 as.Ret(); in CondTest1()
165 as.Finalize(); in CondTest1()
186 CodeEmitter as(&code); in CondTest2() local
187 as.Movl(Assembler::edx, {.base = Assembler::esp, .disp = 4}); // arg1. in CondTest2()
188 as.Movl(Assembler::ecx, {.base = Assembler::esp, .disp = 8}); // arg2. in CondTest2()
189 as.Xorl(Assembler::eax, Assembler::eax); in CondTest2()
190 as.Testb(Assembler::edx, Assembler::ecx); in CondTest2()
191 as.Setcc(Assembler::Condition::kNotZero, Assembler::eax); in CondTest2()
192 as.Xchgl(Assembler::eax, Assembler::ecx); in CondTest2()
193 as.Xchgl(Assembler::ecx, Assembler::eax); in CondTest2()
194 as.Ret(); in CondTest2()
195 as.Finalize(); in CondTest2()
216 CodeEmitter as(&code); in JccTest() local
218 as.Movl(Assembler::edx, {.base = Assembler::esp, .disp = 4}); // arg1. in JccTest()
219 as.Movl(Assembler::ecx, {.base = Assembler::esp, .disp = 8}); // arg2. in JccTest()
220 as.Cmpl(Assembler::edx, Assembler::ecx); in JccTest()
221 as.Jcc(Assembler::Condition::kEqual, equal); in JccTest()
222 as.Jcc(Assembler::Condition::kBelow, below); in JccTest()
223 as.Jcc(Assembler::Condition::kAbove, above); in JccTest()
225 as.Movl(Assembler::eax, 13); in JccTest()
226 as.Jmp(done); in JccTest()
228 as.Bind(&equal); in JccTest()
229 as.Movl(Assembler::eax, 0u); in JccTest()
230 as.Jmp(done); in JccTest()
232 as.Bind(&below); in JccTest()
233 as.Movl(Assembler::eax, -1); in JccTest()
234 as.Jmp(done); in JccTest()
236 as.Bind(&above); in JccTest()
237 as.Movl(Assembler::eax, 1); in JccTest()
238 as.Jmp(done); in JccTest()
240 as.Bind(&done); in JccTest()
241 as.Ret(); in JccTest()
242 as.Finalize(); in JccTest()
268 CodeEmitter as(&code); in ShiftTest() local
269 as.Movl(Assembler::eax, {.base = Assembler::esp, .disp = 4}); in ShiftTest()
270 as.Shll(Assembler::eax, int8_t{2}); in ShiftTest()
271 as.Shrl(Assembler::eax, int8_t{1}); in ShiftTest()
272 as.Movl(Assembler::ecx, 3); in ShiftTest()
273 as.ShllByCl(Assembler::eax); in ShiftTest()
274 as.Ret(); in ShiftTest()
275 as.Finalize(); in ShiftTest()
286 CodeEmitter as(&code); in LogicTest() local
287 as.Movl(Assembler::eax, {.base = Assembler::esp, .disp = 4}); in LogicTest()
288 as.Movl(Assembler::ecx, 0x1); in LogicTest()
289 as.Xorl(Assembler::eax, Assembler::ecx); in LogicTest()
290 as.Movl(Assembler::ecx, 0xf); in LogicTest()
291 as.Andl(Assembler::eax, Assembler::ecx); in LogicTest()
292 as.Ret(); in LogicTest()
293 as.Finalize(); in LogicTest()
304 CodeEmitter as(&code); in BsrTest() local
306 as.Movl(Assembler::ecx, {.base = Assembler::esp, .disp = 4}); in BsrTest()
307 as.Movl(Assembler::edx, 239); in BsrTest()
308 as.Bsrl(Assembler::eax, Assembler::ecx); in BsrTest()
309 as.Cmovl(Assembler::Condition::kZero, Assembler::eax, Assembler::edx); in BsrTest()
310 as.Ret(); in BsrTest()
311 as.Finalize(); in BsrTest()
322 CodeEmitter as(&code); in CallFPTest() local
323 as.Push(0x3f800000); in CallFPTest()
324 as.Push(0x40000000); in CallFPTest()
325 as.Call(bit_cast<const void*>(&FloatFunc)); in CallFPTest()
326 as.Fstps({.base = Assembler::esp}); in CallFPTest()
327 as.Pop(Assembler::eax); in CallFPTest()
328 as.Addl(Assembler::esp, 4); in CallFPTest()
329 as.Ret(); in CallFPTest()
330 as.Finalize(); in CallFPTest()
341 CodeEmitter as(&code); in XmmTest() local
342 as.Movl(Assembler::eax, 0x3f800000); in XmmTest()
343 as.Movd(Assembler::xmm0, Assembler::eax); in XmmTest()
344 as.Movl(Assembler::eax, 0x40000000); in XmmTest()
345 as.Movd(Assembler::xmm5, Assembler::eax); in XmmTest()
346 as.Addss(Assembler::xmm0, Assembler::xmm5); in XmmTest()
347 as.Movd(Assembler::eax, Assembler::xmm0); in XmmTest()
348 as.Ret(); in XmmTest()
349 as.Finalize(); in XmmTest()
360 CodeEmitter as(&code); in ReadGlobalTest() local
363 as.Movsd(Assembler::xmm0, {.disp = bit_cast<int32_t>(&kData)}); in ReadGlobalTest()
364 as.Movdqa(Assembler::xmm1, {.disp = bit_cast<int32_t>(&kData)}); in ReadGlobalTest()
365 as.Movl(Assembler::eax, {.base = Assembler::esp, .disp = 4}); in ReadGlobalTest()
366 as.Movl(Assembler::ecx, {.base = Assembler::esp, .disp = 8}); in ReadGlobalTest()
367 as.Movsd({.base = Assembler::eax}, Assembler::xmm0); in ReadGlobalTest()
368 as.Movdqu({.base = Assembler::ecx}, Assembler::xmm1); in ReadGlobalTest()
370 as.Ret(); in ReadGlobalTest()
371 as.Finalize(); in ReadGlobalTest()
436 CodeEmitter as(&code); in LabelTest() local
438 as.Call(bit_cast<const void*>(&Callee)); in LabelTest()
439 as.Jmp(skip); in LabelTest()
440 as.Movl(Assembler::rax, 2); in LabelTest()
441 as.Bind(&skip); in LabelTest()
442 as.Addb(Assembler::rax, {end}); in LabelTest()
443 as.Jmp(skip2); in LabelTest()
444 as.Bind(&back); in LabelTest()
445 as.Addl(Assembler::rax, 12); in LabelTest()
446 as.Jmp(end); in LabelTest()
447 as.Bind(&skip2); in LabelTest()
448 as.Jmp(back); in LabelTest()
449 as.Bind(&end); in LabelTest()
450 as.Ret(); in LabelTest()
451 as.Finalize(); in LabelTest()
462 CodeEmitter as(&code); in CondTest1() local
463 as.Movl(Assembler::rax, 0xcccccccc); in CondTest1()
464 as.Cmpl(Assembler::rdi, Assembler::rsi); in CondTest1()
465 as.Setcc(Assembler::Condition::kEqual, Assembler::rax); in CondTest1()
466 as.Ret(); in CondTest1()
467 as.Finalize(); in CondTest1()
491 CodeEmitter as(&code); in CondTest2() local
492 as.Movl(Assembler::rdx, Assembler::rdi); // arg1. in CondTest2()
493 as.Movl(Assembler::rcx, Assembler::rsi); // arg2. in CondTest2()
494 as.Xorl(Assembler::rax, Assembler::rax); in CondTest2()
495 as.Testb(Assembler::rdx, Assembler::rcx); in CondTest2()
496 as.Setcc(Assembler::Condition::kNotZero, Assembler::rax); in CondTest2()
497 as.Xchgq(Assembler::rax, Assembler::rcx); in CondTest2()
498 as.Xchgq(Assembler::rcx, Assembler::rax); in CondTest2()
499 as.Xchgq(Assembler::rcx, Assembler::r11); in CondTest2()
500 as.Xchgq(Assembler::r11, Assembler::rcx); in CondTest2()
501 as.Ret(); in CondTest2()
502 as.Finalize(); in CondTest2()
523 CodeEmitter as(&code); in JccTest() local
525 as.Cmpl(Assembler::rdi, Assembler::rsi); in JccTest()
526 as.Jcc(Assembler::Condition::kEqual, equal); in JccTest()
527 as.Jcc(Assembler::Condition::kBelow, below); in JccTest()
528 as.Jcc(Assembler::Condition::kAbove, above); in JccTest()
530 as.Movl(Assembler::rax, 13); in JccTest()
531 as.Jmp(done); in JccTest()
533 as.Bind(&equal); in JccTest()
534 as.Movq(Assembler::rax, 0); in JccTest()
535 as.Jmp(done); in JccTest()
537 as.Bind(&below); in JccTest()
538 as.Movl(Assembler::rax, -1); in JccTest()
539 as.Jmp(done); in JccTest()
541 as.Bind(&above); in JccTest()
542 as.Movl(Assembler::rax, 1); in JccTest()
543 as.Jmp(done); in JccTest()
545 as.Bind(&done); in JccTest()
546 as.Ret(); in JccTest()
547 as.Finalize(); in JccTest()
574 CodeEmitter as(&code); in ReadWriteTest() local
576 as.Movq(Assembler::rax, 0); in ReadWriteTest()
577 as.Movb(Assembler::rax, {.base = Assembler::rdi}); in ReadWriteTest()
578 as.Movl(Assembler::rcx, {.base = Assembler::rsi}); in ReadWriteTest()
579 as.Addl(Assembler::rax, Assembler::rcx); in ReadWriteTest()
580 as.Movl({.base = Assembler::rsi}, Assembler::rax); in ReadWriteTest()
581 as.Ret(); in ReadWriteTest()
582 as.Finalize(); in ReadWriteTest()
595 CodeEmitter as(&code); in CallFPTest() local
596 as.Movl(Assembler::rax, 0x40000000); in CallFPTest()
597 as.Movd(Assembler::xmm0, Assembler::rax); in CallFPTest()
598 as.Movl(Assembler::rax, 0x3f800000); in CallFPTest()
599 as.Movd(Assembler::xmm1, Assembler::rax); in CallFPTest()
600 as.Call(bit_cast<const void*>(&FloatFunc)); in CallFPTest()
601 as.Movd(Assembler::rax, Assembler::xmm0); in CallFPTest()
602 as.Ret(); in CallFPTest()
603 as.Finalize(); in CallFPTest()
614 CodeEmitter as(&code); in XmmTest() local
615 as.Movl(Assembler::rax, 0x40000000); in XmmTest()
616 as.Movd(Assembler::xmm0, Assembler::rax); in XmmTest()
617 as.Movl(Assembler::rax, 0x3f800000); in XmmTest()
618 as.Movd(Assembler::xmm11, Assembler::rax); in XmmTest()
619 as.Addss(Assembler::xmm0, Assembler::xmm11); in XmmTest()
620 as.Movaps(Assembler::xmm12, Assembler::xmm0); in XmmTest()
621 as.Addss(Assembler::xmm0, Assembler::xmm12); in XmmTest()
622 as.Movapd(Assembler::xmm14, Assembler::xmm1); in XmmTest()
623 as.Movd(Assembler::rax, Assembler::xmm0); in XmmTest()
624 as.Ret(); in XmmTest()
625 as.Finalize(); in XmmTest()
636 CodeEmitter as(&code); in XmmMemTest() local
638 as.Movsd(Assembler::xmm0, {.base = Assembler::rdi}); in XmmMemTest()
639 as.Movaps(Assembler::xmm12, Assembler::xmm0); in XmmMemTest()
640 as.Addsd(Assembler::xmm12, Assembler::xmm12); in XmmMemTest()
641 as.Movsd({.base = Assembler::rdi}, Assembler::xmm12); in XmmMemTest()
642 as.Movq(Assembler::rax, Assembler::xmm0); in XmmMemTest()
643 as.Ret(); in XmmMemTest()
644 as.Finalize(); in XmmMemTest()
660 CodeEmitter as(&code); in MovsxblRexTest() local
662 as.Xorl(Assembler::rdx, Assembler::rdx); in MovsxblRexTest()
663 as.Movl(Assembler::rsi, 0xdeadff); in MovsxblRexTest()
666 as.Movsxbl(Assembler::rax, Assembler::rsi); in MovsxblRexTest()
667 as.Ret(); in MovsxblRexTest()
668 as.Finalize(); in MovsxblRexTest()
680 CodeEmitter as(&code); in MovzxblRexTest() local
682 as.Xorl(Assembler::rdx, Assembler::rdx); in MovzxblRexTest()
683 as.Movl(Assembler::rsi, 0xdeadff); in MovzxblRexTest()
686 as.Movzxbl(Assembler::rax, Assembler::rsi); in MovzxblRexTest()
687 as.Ret(); in MovzxblRexTest()
688 as.Finalize(); in MovzxblRexTest()
700 CodeEmitter as(&code); in ShldlRexTest() local
702 as.Movl(Assembler::rdx, 0x12345678); in ShldlRexTest()
706 as.Xorl(Assembler::r8, Assembler::r8); in ShldlRexTest()
707 as.Movl(Assembler::rax, 0xdeadbeef); in ShldlRexTest()
708 as.Movl(Assembler::r10, 0xdeadbeef); in ShldlRexTest()
710 as.Shldl(Assembler::r8, Assembler::rdx, int8_t{8}); in ShldlRexTest()
711 as.Movl(Assembler::rcx, 8); in ShldlRexTest()
712 as.ShldlByCl(Assembler::r8, Assembler::rdx); in ShldlRexTest()
714 as.Movl(Assembler::rax, Assembler::r8); in ShldlRexTest()
716 as.Ret(); in ShldlRexTest()
717 as.Finalize(); in ShldlRexTest()
729 CodeEmitter as(&code); in ShrdlRexTest() local
731 as.Movl(Assembler::rdx, 0x12345678); in ShrdlRexTest()
735 as.Xorl(Assembler::r8, Assembler::r8); in ShrdlRexTest()
736 as.Movl(Assembler::rax, 0xdeadbeef); in ShrdlRexTest()
737 as.Movl(Assembler::r10, 0xdeadbeef); in ShrdlRexTest()
739 as.Shrdl(Assembler::r8, Assembler::rdx, int8_t{8}); in ShrdlRexTest()
740 as.Movl(Assembler::rcx, 8); in ShrdlRexTest()
741 as.ShrdlByCl(Assembler::r8, Assembler::rdx); in ShrdlRexTest()
743 as.Movl(Assembler::rax, Assembler::r8); in ShrdlRexTest()
745 as.Ret(); in ShrdlRexTest()
746 as.Finalize(); in ShrdlRexTest()
758 CodeEmitter as(&code); in ReadGlobalTest() local
767 as.Movsd(Assembler::xmm0, {.disp = data_offset}); in ReadGlobalTest()
768 as.Movdqa(Assembler::xmm1, {.disp = data_offset}); in ReadGlobalTest()
769 as.Movsd({.base = Assembler::rdi}, Assembler::xmm0); in ReadGlobalTest()
770 as.Movdqu({.base = Assembler::rsi}, Assembler::xmm1); in ReadGlobalTest()
772 as.Ret(); in ReadGlobalTest()
773 as.Finalize(); in ReadGlobalTest()
789 CodeEmitter as(&code); in MemShiftTest() local
791 as.Push(Assembler::rdi); in MemShiftTest()
792 as.Movl(Assembler::rcx, 1); in MemShiftTest()
793 as.ShrlByCl({.base = Assembler::rsp}); in MemShiftTest()
794 as.Addl(Assembler::rcx, 1); in MemShiftTest()
795 as.Movq(Assembler::rdi, Assembler::rsp); in MemShiftTest()
796 as.ShllByCl({.base = Assembler::rdi}); in MemShiftTest()
797 as.Pop(Assembler::rax); in MemShiftTest()
799 as.Ret(); in MemShiftTest()
800 as.Finalize(); in MemShiftTest()
824 void GenInsnsCommon(CodeEmitter* as);
825 void GenInsnsArch(CodeEmitter* as);
836 void GenInsnsCommon(CodeEmitter* as);
837 void GenInsnsArch(CodeEmitter* as);
844 CodeEmitter as(&code); in ExhaustiveTest() local
847 berberis::x86_32::GenInsnsCommon(&as); in ExhaustiveTest()
848 berberis::x86_32::GenInsnsArch(&as); in ExhaustiveTest()
850 berberis::x86_64::GenInsnsCommon(&as); in ExhaustiveTest()
851 berberis::x86_64::GenInsnsArch(&as); in ExhaustiveTest()
853 as.Finalize(); in ExhaustiveTest()