-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jiaan Lu <[email protected]>
- Loading branch information
Showing
46 changed files
with
1,263 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (c) 2024 Intel Corporation. | ||
# Jiaan Lu <[email protected]> | ||
|
||
CFLAGS = -g | ||
|
||
src = $(filter-out cmpxadd.c, $(wildcard *.c)) | ||
target = $(patsubst %.c, %, ${src}) | ||
|
||
.PHONY: all clean | ||
|
||
%:%.c | ||
$(CC) ${CFLAGS} $^ -o $@ | ||
|
||
all: ${target} | ||
|
||
clean: | ||
rm -f ${target} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# CMPccXADD | ||
|
||
## Description | ||
CMPccXADD is a new set of instructions in the latest Intel platform | ||
Sierra Forest. This new instruction set includes a semaphore operation | ||
that can compare and add the operands if condition is met, which can | ||
improve database performance. | ||
|
||
This test suite provides basic functional check to ensure CMPccXADD works properly. | ||
|
||
## Usage | ||
``` | ||
make | ||
# To run a specific case | ||
(for example) ./cmpbexadd_above | ||
# To run all cases at once | ||
./runtest_all.sh | ||
``` | ||
Test results (PASS or FAIL) will be printed out. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputUnsigned output; | ||
uop1 = 2; | ||
uop2 = 1; | ||
uop3 = 3; | ||
output = cmp_be_add(uop1, uop2, uop3); | ||
printf("cmp_be_add - target: *(rax) = 2, rbx = 2, rcx = 3, rflags = 0x202\n"); | ||
if (output.rax == 2 && output.rbx == 2 && output.rcx == 3 && output.rflags == 0x202) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputUnsigned output; | ||
uop1 = 1; | ||
uop2 = 2; | ||
uop3 = 3; | ||
output = cmp_be_add(uop1, uop2, uop3); | ||
printf("cmp_be_add - target: *(rax) = 4, rbx = 1, rcx = 3, rflags = 0x297\n"); | ||
if (output.rax == 4 && output.rbx == 1 && output.rcx == 3 && output.rflags == 0x297) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputUnsigned output; | ||
uop1 = 2; | ||
uop2 = 2; | ||
uop3 = 3; | ||
output = cmp_be_add(uop1, uop2, uop3); | ||
printf("cmp_be_add - target: *(rax) = 5, rbx = 2, rcx = 3, rflags = 0x246\n"); | ||
if (output.rax == 5 && output.rbx == 2 && output.rcx == 3 && output.rflags == 0x246) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputUnsigned output; | ||
uop1 = 2; | ||
uop2 = 1; | ||
uop3 = 3; | ||
output = cmp_b_add(uop1, uop2, uop3); | ||
printf("cmp_b_add - target: *(rax) = 2, rbx = 2, rcx = 3, rflags = 0x202\n"); | ||
if (output.rax == 2 && output.rbx == 2 && output.rcx == 3 && output.rflags == 0x202) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputUnsigned output; | ||
uop1 = 1; | ||
uop2 = 2; | ||
uop3 = 3; | ||
output = cmp_b_add(uop1, uop2, uop3); | ||
printf("cmp_b_add - target: *(rax) = 4, rbx = 1, rcx = 3, rflags = 0x297\n"); | ||
if (output.rax == 4 && output.rbx == 1 && output.rcx == 3 && output.rflags == 0x297) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputUnsigned output; | ||
uop1 = 2; | ||
uop2 = 2; | ||
uop3 = 3; | ||
output = cmp_b_add(uop1, uop2, uop3); | ||
printf("cmp_b_add - target: *(rax) = 2, rbx = 2, rcx = 3, rflags = 0x246\n"); | ||
if (output.rax == 2 && output.rbx == 2 && output.rcx == 3 && output.rflags == 0x246) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputSigned output; | ||
op1 = -1; | ||
op2 = -1; | ||
op3 = 2; | ||
output = cmp_le_add(op1, op2, op3); | ||
printf("cmp_le_add - target: *(rax) = 1, rbx = -1, rcx = 2, rflags = 0x246\n"); | ||
if (output.rax == 1 && output.rbx == -1 && output.rcx == 2 && output.rflags == 0x246) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputSigned output; | ||
op1 = -1; | ||
op2 = 1; | ||
op3 = 2; | ||
output = cmp_le_add(op1, op2, op3); | ||
printf("cmp_le_add - target: *(rax) = 1, rbx = -1, rcx = 2, rflags = 0x282\n"); | ||
if (output.rax == 1 && output.rbx == -1 && output.rcx == 2 && output.rflags == 0x282) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputSigned output; | ||
op1 = -1; | ||
op2 = -2; | ||
op3 = 2; | ||
output = cmp_le_add(op1, op2, op3); | ||
printf("cmp_le_add - target: *(rax) = -1, rbx = -1, rcx = 2, rflags = 0x202\n"); | ||
if (output.rax == -1 && output.rbx == -1 && output.rcx == 2 && output.rflags == 0x202) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputSigned output; | ||
op1 = -1; | ||
op2 = -1; | ||
op3 = 2; | ||
output = cmp_l_add(op1, op2, op3); | ||
printf("cmp_l_add - target: *(rax) = -1, rbx = -1, rcx = 2, rflags = 0x246\n"); | ||
if (output.rax == -1 && output.rbx == -1 && output.rcx == 2 && output.rflags == 0x246) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputSigned output; | ||
op1 = -1; | ||
op2 = 1; | ||
op3 = 2; | ||
output = cmp_l_add(op1, op2, op3); | ||
printf("cmp_l_add - target: *(rax) = 1, rbx = -1, rcx = 2, rflags = 0x282\n"); | ||
if (output.rax == 1 && output.rbx == -1 && output.rcx == 2 && output.rflags == 0x282) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* | ||
* Copyright (c) 2024 Intel Corporation. | ||
* Jiaxi Chen <[email protected]> | ||
* Jiaan Lu <[email protected]> | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <limits.h> | ||
#include "cmpxadd.c" | ||
void main() { | ||
unsigned long uop1, uop2, uop3; | ||
long op1, op2, op3; | ||
struct OutputSigned output; | ||
op1 = -1; | ||
op2 = -2; | ||
op3 = 2; | ||
output = cmp_l_add(op1, op2, op3); | ||
printf("cmp_l_add - target: *(rax) = -1, rbx = -1, rcx = 2, rflags = 0x202\n"); | ||
if (output.rax == -1 && output.rbx == -1 && output.rcx == 2 && output.rflags == 0x202) { | ||
printf("Test passed\n"); | ||
} else { | ||
printf("Test failed\n"); | ||
} | ||
} |
Oops, something went wrong.