x86: paddq

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-10 00:00:00 +00:00
parent 5d774c0947
commit 16ecab4af0
4 changed files with 37 additions and 13 deletions

View File

@@ -11493,7 +11493,7 @@ One "downside" of glibc is that it exercises much more kernel functionality on i
== C
Programs under link:userland/c/[] are examples of link:https://en.wikipedia.org/wiki/ANSI_C[ANSI C] programming.
Programs under link:userland/c/[] are examples of link:https://en.wikipedia.org/wiki/ANSI_C[ANSI C] programming:
* Standard library
** assert.h
@@ -11541,19 +11541,19 @@ What is POSIX:
== Userland assembly
Programs under `userland/arch/<arch>/` are examples of userland assembly programming:
Programs under `userland/arch/<arch>/` are examples of userland assembly programming.
* link:userland/arch/x86_64/[] moved from: https://github.com/cirosantilli/x86-assembly-cheat
* link:userland/arch/arm/[] moved from: https://github.com/cirosantilli/arm-assembly-cheat
* link:userland/arch/aarch64/[] moved from: https://github.com/cirosantilli/arm-assembly-cheat
This section will document ISA agnostic concepts.
ISA specifics are covered at:
* <<x86-userland-assembly>> under link:userland/arch/x86_64/[], originally migrated from: https://github.com/cirosantilli/x86-assembly-cheat
* <<arm-userland-assembly>> under originally migrated from https://github.com/cirosantilli/arm-assembly-cheat under:
** link:userland/arch/arm/[]
** link:userland/arch/aarch64/[]
Like other userland programs, these programs can be run as explained at: <<userland-setup>>.
This section will document ISA generic ideas. ISA specifics are documented on the following sections:
* <<x86-userland-assembly>>
* <<arm-userland-assembly>>
The first example that you want to run for each arch is:
....
@@ -11836,7 +11836,10 @@ Once those are done, everything else left on userland is just to learn a huge li
=== x86 userland assembly instructions
TODO
==== x86 SIMD
* SVE2
** link:userland/arch/x86_64/paddq.S[]
=== rdtsc

View File

@@ -13,7 +13,7 @@ ENTRY
.data
u32_0: .word 0xF111F111, 0xF222F222, 0xF333F333, 0xF444F444
u32_1: .word 0x15551555, 0x16661666, 0x17771777, 0x18881888
u32_sum_expect: .word 0x06670666, 0x08890888, 0x0AAB0AAA, 0x0CCD0CCC
u32_sum_expect: .word 0x06670666, 0x08890889, 0x0AAB0AAA, 0x0CCD0CCC
.bss
u32_sum: .skip 16
.text

View File

@@ -39,7 +39,7 @@ int assert_memcmp(const void *s1, const void *s2, size_t n) {
printf(
"%s failed: "
"byte1, byte2, index: "
"0x%02" PRIX8 " 0x%02" PRIX8 " 0x%zx\n",
"0x%02" PRIX8 " 0x%02" PRIX8 " 0x%zX\n",
__func__,
b1,
b2,

View File

@@ -0,0 +1,21 @@
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-simd
*
* Add 4 32-bit integeres in one go.
*/
#include "common.h"
ENTRY
.data
u32_0: .long 0xF111F111, 0xF222F222, 0xF333F333, 0xF444F444
u32_1: .long 0x15551555, 0x16661666, 0x17771777, 0x18881888
u32_expect: .long 0x06670666, 0x08890889, 0x0AAB0AAA, 0x0CCD0CCD
.bss
u32_result: .skip 16
.text
movups u32_0, %xmm0
movups u32_1, %xmm1
paddq %xmm1, %xmm0
movups %xmm0, u32_result
ASSERT_MEMCMP(u32_result, u32_expect, $0x10)
EXIT