Last active
October 5, 2024 19:59
-
-
Save pkhuong/6becf80d302d24a9f37f5cef2bb54815 to your computer and use it in GitHub Desktop.
BAD TEST CASE REDUCTION ON MY END
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
.file "foo.c" | |
.globl foo // -- Begin function foo | |
.p2align 2 | |
.type foo,@function | |
foo: // @foo | |
.cfi_startproc | |
// %bb.0: | |
movi v0.2d, #0000000000000000 | |
//APP | |
//first use v0 | |
//NO_APP | |
mov v1.16b, v0.16b | |
//APP | |
//clobber | |
//NO_APP | |
mov v0.16b, v1.16b | |
//APP | |
//last use v0 | |
//NO_APP | |
ret | |
.Lfunc_end0: | |
.size foo, .Lfunc_end0-foo | |
.cfi_endproc | |
// -- End function | |
.ident "clang version 18.1.8 (Fedora 18.1.8-1.fc40)" | |
.section ".note.GNU-stack","",@progbits | |
.addrsig |
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
# gcc -march=armv8-a+crypto -O2 reduced_case.c -S | |
o | |
.file "foo.c" | |
.text | |
.align 2 | |
.p2align 5,,15 | |
.global foo | |
.type foo, %function | |
foo: | |
.LFB3916: | |
.cfi_startproc | |
movi v0.4s, 0 | |
#APP | |
// 11 "foo.c" 1 | |
#first use v0 | |
// 0 "" 2 | |
// 14 "foo.c" 1 | |
#clobber | |
// 0 "" 2 | |
// 17 "foo.c" 1 | |
#last use v0 | |
// 0 "" 2 | |
#NO_APP | |
ret | |
.cfi_endproc | |
.LFE3916: | |
.size foo, .-foo | |
.ident "GCC: (GNU) 14.2.1 20240912 (Red Hat 14.2.1-3)" | |
.section .note.GNU-stack,"",@progbits |
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
#include <arm_neon.h> | |
typedef uint64x2_t v128; | |
v128 foo() | |
{ | |
// We'll hint to the compiler that this value should go in v0. | |
register v128 x asm("v0") = { 0 }; | |
// Confirm that it is in v0 | |
asm volatile(" #first use %0" : "+w"(x)); | |
// Clobber v0... surely there must be a backup/restore sequence? | |
// XXX https://hachyderm.io/@pinskia/113256478102232611 | |
// This is actually WAI. | |
asm volatile(" #clobber" ::: "v0"); | |
// Confirm that the value is restored in v0 | |
asm volatile(" #last use %0" : "+w"(x)); | |
// Use the value. | |
return x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to use asm variables to reduce a test case, but that just results in a surprisingly invalid program https://hachyderm.io/@pinskia/113256478102232611