Skip to content

x86: use gcc 6+ asm flag output feature

H. Peter Anvin lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 2 repliesIn review
  2. v110 patches 21 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10x86, bitops: remove use of "sbb" to return CFarch/x86/include/asm/bitops.h arch/x86/include/asm/percpu.h arch/x86/include/asm/signal.h +2 more+31 -340 replies
2/10x86, asm: use bool for bitops and other assembly outputsarch/x86/boot/bitops.h arch/x86/boot/boot.h arch/x86/boot/string.c +10 more+69 -660 replies
3/10x86, asm: change the GEN_*_RMWcc() macros to not quote the conditionarch/x86/include/asm/atomic.h arch/x86/include/asm/atomic64_64.h arch/x86/include/asm/bitops.h +3 more+18 -180 replies
4/10x86, asm: define CC_SET() and CC_OUT() macrosarch/x86/include/asm/asm.h+12 -00 replies
5/10x86, asm: change GEN_*_RMWcc() to use CC_SET()/CC_OUT()arch/x86/include/asm/rmwcc.h+9 -50 replies
6/10x86, asm: Use CC_SET()/CC_OUT() in <asm/bitops.h>arch/x86/include/asm/bitops.h+8 -80 replies
7/10x86, asm: Use CC_SET()/CC_OUT() in <asm/percpu.h>arch/x86/include/asm/percpu.h+5 -40 replies
8/10x86, asm: Use CC_SET()/CC_OUT() in <asm/rwsem.h>arch/x86/include/asm/rwsem.h+2 -20 replies
9/10x86, asm, boot: Use CC_SET()/CC_OUT() in arch/x86/boot/boot.harch/x86/boot/boot.h+5 -40 replies
10/10x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.harch/x86/include/asm/archrandom.h arch/x86/kernel/cpu/rdrand.c+62 -701 reply

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchAndy LutomirskiBorislav PetkovPeter Zijlstra (Intel)
1/10R-b R-b A-b
2/10R-b R-b A-b
3/10R-b R-b A-b
4/10R-b R-b A-b
5/10R-b R-b A-b
6/10R-b R-b A-b
7/10R-b R-b A-b
8/10R-b R-b A-b
9/10R-b R-b A-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/10] x86: use gcc 6+ asm flag output feature

From: "H. Peter Anvin" <[email protected]>

gcc 6+ has the ability to let flags (actually, conditions, which are specific combinations of flags) to be used directly as asm() outputs. The syntax for that is "=@cc<cc>" where <cc> is the same set of letters that would be used in a j<cc> or set<cc> instruction (e.g. "=@ccz" to test the ZF flag.)

This patchset by itself reduces the size of the x86-64 kernel by 0.12%, from a baseline of 4.7-rc2 built with gcc 6.1 (first line is with the patchset, the second one is without):

text data bss dec hex filename

 68245656   41004339  20533248  129783243   7bc55cb o.i386-allconfig/vmlinux
 68355716   41008499  20533248  129897463   7be13f7 o.i386-allconfig/vmlinux
127384005  129742359  38150144  295276508  11998fdc o.x86_64-allconfig/vmlinux
127538765  129742295  38150144  295431204  119bec24 o.x86_64-allconfig/vmlinux

v2: fix a conflict between <linux/random.h> and <asm/archrandom.h>
discovered by Ingo Molnar. There are a few places in x86-specific code where we need all of <arch/archrandom.h> even when xCONFIG_ARCH_RANDOM is disabled, so <linux/random.h> does not suffice. Only the <asm/archrandom.h> patch has been changed; since it is a little bit different from the others I have moved it to the end.