forked from GrammaTech/ddisasm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'junghee/avx512f' into 'main'
Separate avx512f instruction out of the ex_aligned_data_in_cope test See merge request rewriting/ddisasm!1204
- Loading branch information
Showing
4 changed files
with
123 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
|
||
all: ex_original.s | ||
gcc ex_original.s -o ex | ||
gcc ex_original2.s -o ex2 | ||
@./ex > out.txt | ||
@./ex2 > out2.txt | ||
clean: | ||
rm -f ex out.txt | ||
rm -fr ex.unstripped ex.s *.old* dl_files *.gtirb | ||
rm -f ex2 out2.txt | ||
rm -fr ex2.unstripped ex2.s | ||
check: | ||
./ex > /tmp/res.txt | ||
@ diff out.txt /tmp/res.txt && echo TEST OK | ||
./ex2 > /tmp/res2.txt | ||
@ diff out2.txt /tmp/res2.txt && echo TEST OK |
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
63 changes: 63 additions & 0 deletions
63
examples/asm_examples/ex_aligned_data_in_code/ex_original2.s
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,63 @@ | ||
# This example is to demonostrate that data-in-code is properly aligned | ||
# when it is referenced by instructions that require explicitly aligned memory. | ||
# If not properly aligned, it may cause a segmentation fault due to alignment | ||
# requirement violation. | ||
# See Table 15-6 in https://cdrdv2.intel.com/v1/dl/getContent/671200. | ||
# | ||
# This example tests avx512 instructions. | ||
|
||
.section .text | ||
|
||
.globl main | ||
.type main, @function | ||
main: | ||
call print_message1 | ||
|
||
# Load data into ZMM register using movdqa: `data512` needs to be aligned. | ||
vmovaps data512(%rip), %zmm0 | ||
|
||
# Load data into ZMM register using vmovups: `data512u` does not need to be aligned. | ||
vmovups data512u(%rip), %zmm1 | ||
|
||
call print_message2 | ||
|
||
xorq %rax, %rax | ||
|
||
ret | ||
|
||
.type print_message1, @function | ||
print_message1: | ||
lea message1(%rip), %rdi | ||
call printf | ||
ret | ||
|
||
.align 16 | ||
.type print_message2, @function | ||
print_message2: | ||
lea message2(%rip), %rdi | ||
call printf | ||
ret | ||
.zero 3 | ||
|
||
.align 64 | ||
data512: | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
|
||
.zero 3 | ||
data512u: | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
.byte 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
|
||
.section .data | ||
|
||
message1: | ||
.ascii "Performing SIMD operations...\n" | ||
.byte 0 | ||
message2: | ||
.ascii "SIMD operations completed.\n" | ||
.byte 0 |
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