mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 04:01:36 +01:00
x86: paddq
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
21
userland/arch/x86_64/paddq.S
Normal file
21
userland/arch/x86_64/paddq.S
Normal 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
|
||||
Reference in New Issue
Block a user