Created
December 15, 2021 04:53
-
-
Save kohnakagawa/7e3dc12730e1e306283775433c03498e to your computer and use it in GitHub Desktop.
ARM64 の ubfx 命令の挙動をテストするためのプログラム
This file contains hidden or 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 <stdio.h> | |
#include <stdint.h> | |
__attribute__((noinline)) | |
uint64_t ubfx(uint64_t src) { | |
uint64_t ret = 0x5555555555555555; | |
asm volatile ("ubfx %0, %1, #4, #24" | |
: "=r"(ret) | |
: "r"(src)); | |
return ret; | |
} | |
int main(){ | |
uint64_t src = 0x823456789ABCDEF0; | |
printf("%lx\n", ubfx(src)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
実行結果