mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
More x86 instructions (#2964)
* Added most x86 cryptographic instructions * Fixed popcnt test * Fixed asm_ops_x64_2.c3t test --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
@@ -6,8 +6,8 @@ fn void main(String[] args)
|
||||
int foo;
|
||||
asm
|
||||
{
|
||||
adcxl $eax, $ecx;
|
||||
adcxq $rax, $rcx;
|
||||
adcx $eax, $ecx;
|
||||
adcx $rax, $rcx;
|
||||
addpd $xmm1, $xmm2;
|
||||
addps $xmm1, $xmm2;
|
||||
addsd $xmm1, $xmm2;
|
||||
@@ -27,4 +27,4 @@ fn void main(String[] args)
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
"adcxl %ecx, %eax\0Aadcxq %rcx, %rax\0Aaddpd %xmm2, %xmm1\0Aaddps %xmm2, %xmm1\0Aaddsd %xmm2, %xmm1\0Aaddss %xmm2, %xmm1\0Avaddpd %xmm3, %xmm2, %xmm1\0Avaddpd %ymm3, %ymm2, %ymm1\0Avaddpd $0, %xmm2, %xmm1\0Avaddps %xmm3, %xmm2, %xmm1\0Avaddps %ymm3, %ymm2, %ymm1\0Avaddps $0, %xmm2, %xmm1\0Avaddsd %xmm3, %xmm2, %xmm1\0Avaddsd $0, %xmm2, %xmm1\0Avaddss %xmm3, %xmm2, %xmm1\0Avaddss $0, %xmm2, %xmm1\0A", "*m,~{cc},~{rcx},~{xmm1},~{flags},~{dirflag},~{fspr}"
|
||||
"adcx %ecx, %eax\0Aadcx %rcx, %rax\0Aaddpd %xmm2, %xmm1\0Aaddps %xmm2, %xmm1\0Aaddsd %xmm2, %xmm1\0Aaddss %xmm2, %xmm1\0Avaddpd %xmm3, %xmm2, %xmm1\0Avaddpd %ymm3, %ymm2, %ymm1\0Avaddpd $0, %xmm2, %xmm1\0Avaddps %xmm3, %xmm2, %xmm1\0Avaddps %ymm3, %ymm2, %ymm1\0Avaddps $0, %xmm2, %xmm1\0Avaddsd %xmm3, %xmm2, %xmm1\0Avaddsd $0, %xmm2, %xmm1\0Avaddss %xmm3, %xmm2, %xmm1\0Avaddss $0, %xmm2, %xmm1\0A", "*m,~{cc},~{rax},~{xmm1},~{flags},~{dirflag},~{fspr}"
|
||||
|
||||
@@ -4,22 +4,22 @@ fn void popcntw() @test
|
||||
{
|
||||
short src = 0xF0;
|
||||
short count = 0;
|
||||
asm { popcntw count, src; }
|
||||
assert(count == 4, "inline asm: popcntw failed");
|
||||
asm { popcnt count, src; }
|
||||
assert(count == 4, "inline asm: popcnt failed");
|
||||
}
|
||||
|
||||
fn void popcntl() @test
|
||||
{
|
||||
int src = 0xF0F0;
|
||||
int count = 0;
|
||||
asm { popcntl count, src; }
|
||||
assert(count == 8, "inline asm: popcntl failed");
|
||||
asm { popcnt count, src; }
|
||||
assert(count == 8, "inline asm: popcnt failed");
|
||||
}
|
||||
|
||||
fn void popcntq() @test
|
||||
{
|
||||
long src = 0xF0F0_F0F0;
|
||||
long count = 0;
|
||||
asm { popcntq count, src; }
|
||||
assert(count == 16, "inline asm: popcntq failed");
|
||||
asm { popcnt count, src; }
|
||||
assert(count == 16, "inline asm: popcnt failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user