diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-12-01 22:30:22 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-12-01 22:30:22 +0100 |
| commit | baf4910870a6e8999802b9a4a22eabd4142a34e3 (patch) | |
| tree | 2d11443dc21e53bd0d99d015cf789937d6d95862 /2020/05/seat_id_ssse3.asm | |
| parent | 49d0c908f24b2c193c9deed1716fe36061ba26a1 (diff) | |
Move all Advent of Codes into one repo
Diffstat (limited to '2020/05/seat_id_ssse3.asm')
| -rw-r--r-- | 2020/05/seat_id_ssse3.asm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/2020/05/seat_id_ssse3.asm b/2020/05/seat_id_ssse3.asm new file mode 100644 index 0000000..4d51cbe --- /dev/null +++ b/2020/05/seat_id_ssse3.asm @@ -0,0 +1,23 @@ +global seat_id + +section .rodata + align 16 + xmm_shuf: db 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 10, 11, 12, 13, 14, 15 + xmm_cmp: db 1, 'RBBBBBBB', 1, 1, 1, 1, 1, 1, 1 + +section .text + +seat_id: + movq xmm0, qword [rdi] ; load first 8 bytes + pshufb xmm0, [rel xmm_shuf] ; reverse byte order and already shift left once + pcmpeqb xmm0, [rel xmm_cmp] + pmovmskb eax, xmm0 ; store mask in return value + xor ecx, ecx + cmp byte [rdi + 8], 'R' + sete cl + or eax, ecx + shl eax, 1 + cmp byte [rdi + 9], 'R' + sete cl + or eax, ecx + ret |
