Hi dw,

patch is ok.  I assume that this feature can produce in some
inline-assembler cases speed pretty well.  Additionally it avoid
useless clobber of a register just to test one-time on flags.

JonY, Jacek:  Could one of you commit this change?  thanks in advance.

Thanks,
Kai

2015-11-18 2:42 GMT+01:00 dw <[email protected]>:
> GCC 6.0 has introduced a new feature that allows inline asm to return flag
> registers (see
> https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#FlagOutputOperands).
> There are a couple dozen intrinsics in intrin-impl.h that would benefit from
> using this.
>
> There is a define that signals if the gcc feature is available, so backward
> compatibility is straight-forward.  I have updated intrin-impl.h and run it
> thru my test suite.  It looks good.
>
> The patch is attached, but I'm no expert with git, so I'm not sure the
> format is correct.  If it would be easier, I can just attach the .h file.
>
> For people who want to know the nitty gritty:
>
> Before this feature, you had to write code like this:
>
>    asm("bt $0, %1 ; setc %0" : "=q" (a) : "r" (value) : "cc");
>
> This would generate code like this:
>
>         bt $0, %ebx
>         setc %al <--------- Convert flags to byte
>         testb   %al, %al <------ Convert byte back to flags
>         jne     .L5
>         leaq    .LC1(%rip), %rcx
>         call    printf
>
> Using @cc, this code
>
>    asm("bt $0, %1" : "=@ccc" (a) : "r" (value) );
>
> produces this output:
>
>         bt $0, %ebx
>         jc      .L5 <--------- Use the flags directly
>         leaq    .LC1(%rip), %rcx
>         call    printf
>
> dw

------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to