Path: utzoo!mnetor!uunet!lll-winken!lll-crg.llnl.gov!bowles From: bowles@lll-crg.llnl.gov (Jeff Bowles) Newsgroups: comp.unix.microport Subject: Re: How can one do inline assembler under Sys5? Message-ID: <5874@lll-winken.llnl.gov> Date: 5 Apr 88 18:17:19 GMT References: <396@coplex.UUCP> <397@coplex.UUCP> Sender: usenet@lll-winken.llnl.gov Reply-To: bowles@lll-crg.llnl.gov.UUCP (Jeff Bowles) Organization: Lawrence Livermore National Laboratory Lines: 50 Keywords: inline assembler under Sys5 If you have certain releases of the System V compiler, you have extended assembler statements. The following is documented in the paging "C Compilation System" release notes for the 3B2, I think, and hasn't made it into other docs yet. It's the same mechanism you'll find in /usr/include/sys/inline.h on many V.3 releases. It's useful to inspect the output ("cc -S") - you'll notice that you can generate certain sequences if the argument is in a register (or constant or memory) and the like. Jeff Bowles ------------------------------------------------------------------------ asm int retzero() { movl $0, %eax } asm int clr(z) { %mem z; movl $0, z } asm int com(z) { %reg z; imull $-1,z,z %mem z; neg z } main() { int z = -1; register zreg = -1; z = retzero(); printf("Z = %d\n", z); z = -1; printf("Z = %d\n", z); clr(z); printf("Z = %d\n", z); z = -1; printf("Z = %d\n", z); printf("Reg = %d\n", zreg); com(z); com(zreg); printf("Z = %d\n", z); printf("Reg = %d\n", zreg); }