search for: __asm

Displaying 20 results from an estimated 77 matches for "__asm".

2018 Nov 26
2
BUGS in code generated for target i386-win32
...via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> LLVM/clang generates wrong code for the following program >> (see <https://godbolt.org/z/UZrrkG>): > > It looks like all of these issues come down to mismatched expectations > on what goes into and out of an __asm block. If you look at the MSVC > documentation (which I think Clang is trying to be compatible with), > it warns against assuming known values are in particular registers at > any point, and even using __fastcall at all for a function with an > __asm block for that reason: > https://...
2018 Nov 26
3
BUGS in code generated for target i386-win32
Hi @ll, LLVM/clang generates wrong code for the following program (see <https://godbolt.org/z/UZrrkG>): --- sample.c --- unsigned __fastcall lfsr32(unsigned argument, unsigned polynomial) { __asm { add ecx, ecx ; ecx = argument << 1 sbb eax, eax ; eax = CF ? -1 : 0 and eax, edx ; eax = CF ? polynomial : 0 xor eax, ecx ; eax = (argument << 1) ^ (CF ? polynomial : 0) } } int main() { unsigned lfsr = 123456789; unsigned period = 0;...
2017 Jun 06
4
LLD support for ld64 mach-o linker synthesised symbols
...rsp movq __image_base(%rip), %rsi leaq start(%rip), %rdx subq __start_static(%rip), %rdx call __start_c In C: /* run C++ constructors in __libc_start_main for x86_64-xnu-musl */ typedef void (*__init_fn)(int, char **, char **, char **); extern __init_fn __init_start __asm("section$start$__DATA$__mod_init_func"); extern __init_fn __init_end __asm("section$end$__DATA$__mod_init_func”); static void __init_mod(int argc, char **argv, char **envp, char **applep) { for (__init_fn *p = &__init_start; p < &__init_end; ++p) {...
2012 Dec 07
0
[LLVMdev] Need to create symbols only once
...and he was proposing to add a Pre-Read file. > > Do you have any other opinions too ? We have a similar requirement in darwin's ld64 linker, but even more general. Any binary can do the following to introspect itself: struct stuff { int a; int b; }; extern struct stuff* stuff_start __asm("section$start$__DATA$__my"); extern struct stuff* stuff_end __asm("section$end$__DATA$__my"); void examineSection() { const struct stuff* p; for (p = stuff_start; p < stuff_end; ++p) { // do stuff with p } } That is, there are magic symbol names which reference the...
2019 Feb 12
2
[RFC] Potential extension to asm statement functionality
...still susceptible to being duplicated: #include <stdint.h> uint32_t f(uint32_t x); uint32_t g(uint32_t x); uint32_t f(uint32_t x) { uint32_t returnValue = g(x); if (returnValue > 0U) { returnValue = 0x40000000; } else { returnValue = 0x80000000; } __asm __volatile__ ("\t.global my_hook_fcn\nmy_hook_fcn:\n"); return returnValue; } uint32_t g(uint32_t x) { return x >> 1U; } If the above definition of f() is compiled with optimization at level 1 or higher, the TailDuplication optimization pass will duplicate and move the asm...
2019 Feb 12
3
[RFC] Potential extension to asm statement functionality
...still susceptible to being duplicated: #include <stdint.h> uint32_t f(uint32_t x); uint32_t g(uint32_t x); uint32_t f(uint32_t x) { uint32_t returnValue = g(x); if (returnValue > 0U) { returnValue = 0x40000000; } else { returnValue = 0x80000000; } __asm __volatile__ ("\t.global my_hook_fcn\nmy_hook_fcn:\n"); return returnValue; } uint32_t g(uint32_t x) { return x >> 1U; } If the above definition of f() is compiled with optimization at level 1 or higher, the TailDuplication optimization pass will duplicate and move the asm...
2012 Dec 07
3
[LLVMdev] Need to create symbols only once
Hi Nick, We have few symbols like __bss_start, __bss_end, which are Undefined symbols in the code. I want a way in the Reader to create specific atoms before the linker bootstraps. I didnt find a way to do that with the existing interfaces. The way it needs to work is as below :- 1) ReaderELF creates Absolute symbols (for __bss_start, __bss_end etc) 2) ReaderELF reads each file and adds
2019 Feb 14
3
[RFC] Potential extension to asm statement functionality
...~ Todd From: Snider, Todd Sent: Wednesday, February 13, 2019 11:40 AM To: 'paul.robinson at sony.com'; efriedma at quicinc.com Cc: llvm-dev at lists.llvm.org Subject: RE: [llvm-dev] [RFC] Potential extension to asm statement functionality The proposed "lbl" constraint below: __asm __volatile__ ("\t.global\t%0\n%0:\n" : "lbl" (my_hook_fcn)); is not quite a "No Touchie!" constraint, but it does allow the user to set the isNotDuplicable flag on the INLINEASM that comes out of the asm statement in order to circumvent optimizations like Tail Duplica...
2012 Jun 14
1
High CPU usage
...day I'm still using the following code before speex_encoder_init and erverything works great: // fix denormals performance issue // http://software.intel.com/en-us/articles/x87-and-sse-floating-point-assists-in-ia-32-flush-to-zero-ftz-and-denormals-are-zero-daz/ __m128 state[32]; __int32 temp; __asm fxsave state; memcpy(&temp, (char*)state + 24, 4); temp |= (1 << 11); // UNDERFLOW_EXCEPTION_MASK temp |= (1 << 15); // FTZ_BIT __asm ldmxcsr temp; Tested with Visual Studio 2010 on x86. Please let me know if it works for you too. Mark -- NEU: FreePhone 3-fach-Flat mit kostenlos...
2013 Jan 07
1
[LLVMdev] Need to create symbols only once
Hi Nick, On 12/7/2012 4:59 PM, Nick Kledzik wrote: > > We have a similar requirement in darwin's ld64 linker, but even more general. Any binary can do the following to introspect itself: > > struct stuff { int a; int b; }; > > extern struct stuff* stuff_start __asm("section$start$__DATA$__my"); > extern struct stuff* stuff_end __asm("section$end$__DATA$__my"); > > void examineSection() { > const struct stuff* p; > for (p = stuff_start; p < stuff_end; ++p) { > // do stuff with p > } > } > > That is,...
2017 Jun 06
2
LLD support for ld64 mach-o linker synthesised symbols
...leaq start(%rip), %rdx > subq __start_static(%rip), %rdx > call __start_c > > In C: > > /* run C++ constructors in __libc_start_main for x86_64-xnu-musl */ > > typedef void (*__init_fn)(int, char **, char **, char **); > extern __init_fn __init_start __asm("section$start$__DATA$__mod_init_func"); > extern __init_fn __init_end __asm("section$end$__DATA$__mod_init_func”); > > static void __init_mod(int argc, char **argv, char **envp, char **applep) > { > for (__init_fn *p = &__init_start; p < &__ini...
2017 Jan 26
2
compiler-rt linux-arm builtins/clear_cache.c depends on kernel headers
...n creating * trampoline functions on the stack for use with nested functions. @@ -108,6 +104,7 @@ void __clear_cache(void *start, void *end) { sysarch(ARM_SYNC_ICACHE, &arg); #elif defined(__linux__) + #define __ARM_NR_cacheflush 0x0f0002 register int start_reg __asm("r0") = (int) (intptr_t) start; const register int end_reg __asm("r1") = (int) (intptr_t) end; const register int flags __asm("r2") = 0; -------------- next part -------------- A non-text attachment was scrubbed... Name: compiler-rt-remove-kernel-...
2013 Feb 28
0
[LLVMdev] [cfe-dev] [MIPS] How can I add a constraint to LLVM/Clang for MIPS BE?
...ight code, it use the same register in inline asm, and the binary will segment fault in MIPS environment. My test case: /* constraint.c */ #include <stdio.h> int main(int argc, char* argv[]) { int a = 4; int b = 10; int c = 0xffbbccdd; int *p = &a; int out = 0; __asm volatile ( "lw %0, %1\n\t" : "=r"(out) : "R"(*p) ); printf("out is %d\n", out); p = &b; __asm volatile ( "lw %0, %1\n\t" : "=r"(out) : "R"(*p) );...
2012 Nov 05
2
[LLVMdev] Unable to Run Inline Asm with MCJIT
...and run a C program containing inline assembly using MCJIT but I am not able to. I have cloned and build LLVM-3.1. Below are more details. Arch : x86 OS : Linux ubuntu 2.6.35-22-generic Sample program : test_inline_asm.c ------------------- #include <stdio.h> int main(){ int a=0; __asm __volatile("movl $5,%%eax\t" "\n movl %%eax,%0":"=r"(a)::"cc","memory" ); printf("a= %d\n",a); } Commands ------------- clang -emit-llvm -S test_inline_asm.c lli -use-mcjit test_inline_asm.s throws, LLVM ERROR: Inline asm no...
2016 Mar 21
2
PATCH: clang/LLVM - Sparc - inline ASM with floating pointer registers
Hi lists, Sorry for cross-posting, but these two patches are of concern to clang and llvm. I'm compiling C-code which includes inline assembler which looks like the following using the sparc-target: static inline float fabsf(float a) { float res; __asm __volatile__("fabss %1, %0;" : "=f"(res) : "f"(a)); return res; } This fails with llvm/clang - trunk/master. I patched clang and llvm and, as I'm new to both project, I'm having doubts that it is enough - however i...
2010 Mar 16
3
[LLVMdev] LLVM-GCC generating too much code from inline assembly
...roblem on LLVM-GCC. In my code, there's a file with a bunch of inline assembly blocks, that worked fine with GCC 4.2. Now, when compiling with LLVM-GCC 4.2, weird things happen. Here's an example: (the blocks are larger than that, but a single line will do to show you what's happening) __asm { mov ebx, iObject } When compiling in release, everything goes fine, and the produced assembly looks like this : ## InlineAsm Start .file "... my filename" ## InlineAsm End ## InlineAsm Start .line 1454 ## InlineAsm End ## InlineAsm Start movl -20(%ebp), $ebx ## InlineAsm End The pr...
2020 Aug 15
2
Adding bitcode to an existing MachO object file
...n a situation where I need to build x86 and arm assembly sources for some sources while the rest will be built with C. I do know that just adding `-fembed-bitcode` to a C sources would embed bitcode, but doing the same for the assembly files will not do that (at least, it will add the 1-byte `_LLVM,__asm` section, but not the `__LLVM,__bitcode` section). Furthermore, I do need the final output to contain bitcode for all files used. So, my question is if it is possible to add the `__LLVM,__bitcode` section later to the MachO object file. I tried to archive the bitcode using `xar` and run `llvm-objc...
2018 Jan 19
2
openssh build failure on High Sierra (10.13.2)
...;/var/empty\" -DHAVE_CONFIG_H -c log.c -o log.o In file included from /usr/include/sys/cdefs.h:587:0, from /usr/include/sys/types.h:75, from includes.h:25, from log.c:37: /usr/include/sys/syslog.h:227:124: error: expected ',' or ';' before '__asm' void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, __DARWIN_EXTSN(syslog)); The corresponding bits from syslog.h are [lines wrapped] #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __DARWIN_C_LEV...
2006 Jun 26
0
[klibc 25/43] ia64 support for klibc
...register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ + : "2" (_r15) ASM_ARGS_0 \ + : "memory" A...
2012 Dec 10
1
[LLVMdev] Need to create symbols only once
...Pre-Read file. >> >> Do you have any other opinions too ? > We have a similar requirement in darwin's ld64 linker, but even more general. Any binary can do the following to introspect itself: > > struct stuff { int a; int b; }; > > extern struct stuff* stuff_start __asm("section$start$__DATA$__my"); > extern struct stuff* stuff_end __asm("section$end$__DATA$__my"); > > void examineSection() { > const struct stuff* p; > for (p = stuff_start; p < stuff_end; ++p) { > // do stuff with p > } > } > > That is,...