x86: speedup local_irq_save() for clang
Subsystems (2)
cover x86: speedup local_irq_save() for clang
clang generates poor code for local_irq_save() callers, because of asm "=rm" output constraint being mishandled.
Frst patch adds ASM_OUTPUT_RM macro, extending ASM_INPUT_RM that Linus added in linux-6.10. Suggested by Uros Bizjak.
Second patch uses it in local_irq_save(), to not penalize gcc while forcing clang to generate better code especially when CONFIG_STACKPROTECTOR_STRONG=y.
smap_save() could also use it, but is not in any fast path.
Eric Dumazet (2):
clang: work around asm output constraint problems x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
arch/x86/include/asm/irqflags.h | 2 +- include/linux/compiler-clang.h | 7 +++++++ include/linux/compiler_types.h | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
PATCH 1/2 clang: work around asm output constraint problems
Work around clang problems with "=rm" asm constraint.
clang seems to always chose the memory output, while it is almost always the worst choice.
Add ASM_OUTPUT_RM so that we can replace "=rm" constraint where it maters for clang, while not penalizing gcc.
--- include/linux/compiler-clang.h | 7 +++++++ include/linux/compiler_types.h | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-)
include/linux/compiler-clang.h +7 -0
@@ -146,6 +146,13 @@#define ASM_INPUT_G "ir"#define ASM_INPUT_RM "r" +/* +* clang has non optimal behavior with "=rm" constraints for asm outputs. +* It favors memory operand, forcing additional logic in tail functions +* when CONFIG_STACKPROTECTOR_STRONG=y. +*/ +#define ASM_OUTPUT_RM "=r" +/* * Declare compiler support for __typeof_unqual__() operator. *
include/linux/compiler_types.h +5 -1
@@ -548,13 +548,17 @@ struct ftrace_likely_data {/* * Clang has trouble with constraints with multiple -* alternative behaviors (mainly "g" and "rm"). +* alternative behaviors ("g" , "rm" and "=rm"). */ #ifndef ASM_INPUT_G #define ASM_INPUT_G "g"#define ASM_INPUT_RM "rm"#endif +#ifndef ASM_OUTPUT_RM +#define ASM_OUTPUT_RM "=rm" +#endif +#ifdef CONFIG_CC_HAS_ASM_INLINE #define asm_inline asm __inline#else
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
Re: [PATCH 1/2] clang: work around asm output constraint problems
Quoted 3 lines · Eric Dumazet
Add
ASM_OUTPUT_RMso that we can replace "=rm" constraint where it maters for clang, while not penalizing gcc.
I'll apply this - and the use case patch in 2/2 - directly, but I'll just group them all together the same wary the input side (RM/G) is already just done right next to each other.
Linus
Re: [PATCH 1/2] clang: work around asm output constraint problems
Quoted 9 lines · Linus Torvalds
Quoted 3 lines · Eric Dumazet
Add
ASM_OUTPUT_RMso that we can replace "=rm" constraint where it maters for clang, while not penalizing gcc.I'll apply this - and the use case patch in 2/2 - directly, but I'll just group them all together the same wary the input side (RM/G) is already just done right next to each other.
SGTM, thanks Linus.
PATCH 2/2 x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
In reply to Eric Dumazetclang is generating very inefficient code for native_save_fl() which is used for local_irq_save() in critical spots.
Allowing the "pop %0" to use memory:
1) forces the compiler to add annoying stack canaries when CONFIG_STACKPROTECTOR_STRONG=y in many places.
2) Almost always is followed by an immediate "move memory,register"
One good example is _raw_spin_lock_irqsave, with 8 extra instructions
ffffffff82067a30 <_raw_spin_lock_irqsave>:ffffffff82067a30: ...ffffffff82067a39: 53 push %rbx
// Three instructions to ajust the stack, read the per-cpu canary // and copy it to 8(%rsp)ffffffff82067a3a: 48 83 ec 10 sub $0x10,%rspffffffff82067a3e: 65 48 8b 05 da 15 45 02 mov %gs:0x24515da(%rip),%rax # <__stack_chk_guard>ffffffff82067a46: 48 89 44 24 08 mov %rax,0x8(%rsp)
ffffffff82067a4b: 9c pushf
// instead of pop %rbx, compiler uses 2 instructions.ffffffff82067a4c: 8f 04 24 pop (%rsp)ffffffff82067a4f: 48 8b 1c 24 mov (%rsp),%rbx
ffffffff82067a53: fa cliffffffff82067a54: b9 01 00 00 00 mov $0x1,%ecxffffffff82067a59: 31 c0 xor %eax,%eaxffffffff82067a5b: f0 0f b1 0f lock cmpxchg %ecx,(%rdi)ffffffff82067a5f: 75 1d jne ffffffff82067a7e <_raw_spin_lock_irqsave+0x4e>
// three instructions to check the stack canaryffffffff82067a61: 65 48 8b 05 b7 15 45 02 mov %gs:0x24515b7(%rip),%rax # <__stack_chk_guard>ffffffff82067a69: 48 3b 44 24 08 cmp 0x8(%rsp),%raxffffffff82067a6e: 75 17 jne ffffffff82067a87
...
// One extra instruction to adjust the stack.ffffffff82067a73: 48 83 c4 10 add $0x10,%rsp
...
// One more instruction in case the stack was mangled.ffffffff82067a87: e8 a4 35 ff ff call ffffffff8205b030 <__stack_chk_fail>
This patch changes nothing for gcc, but for clang saves ~20000 bytes of text even though more functions are inlined.
$ size vmlinux.gcc.before vmlinux.gcc.after vmlinux.clang.before vmlinux.clang.after text data bss dec hex filename 45565821 25005462 4704800 75276083 47c9f33 vmlinux.gcc.before 45565821 25005462 4704800 75276083 47c9f33 vmlinux.gcc.after 45121072 24638617 5533040 75292729 47ce039 vmlinux.clang.before 45093887 24638633 5536808 75269328 47c84d0 vmlinux.clang.after
$ scripts/bloat-o-meter -t vmlinux.clang.before vmlinux.clang.after add/remove: 1/2 grow/shrink: 21/533 up/down: 2250/-22112 (-19862) Function old new delta wakeup_cpu_via_vmgexit 1002 1447 +445 rcu_tasks_trace_pregp_step 1052 1454 +402 snp_kexec_finish 1290 1527 +237 check_all_holdout_tasks_trace 909 1106 +197 x2apic_send_IPI_mask_allbutself 38 198 +160 hpet_set_rtc_irq_bit 118 265 +147 x2apic_send_IPI_mask 38 184 +146 ring_buffer_poll_wait 261 405 +144 rb_watermark_hit 253 386 +133 __unlikely_text_end 368 416 +48 printk_trigger_flush 262 298 +36 __softirqentry_text_end - 32 +32 pstore_dump 1145 1164 +19 printk_legacy_allow_panic_sync 159 178 +19 netlink_insert 979 995 +16 console_try_replay_all 268 283 +15 do_flush_tlb_all 151 165 +14 __flush_tlb_all 151 165 +14 synchronize_rcu_expedited 2248 2259 +11 ... tcp_wfree 402 332 -70 stacktrace_trigger 133 62 -71 w1_touch_bit 418 343 -75 w1_triplet 446 370 -76 link_create 980 902 -78 drain_dead_softirq_workfn 425 347 -78 kcryptd_queue_crypt 253 174 -79 perf_event_aux_pause 448 368 -80 idle_worker_timeout 320 240 -80 srcu_funnel_exp_start 418 333 -85 call_rcu 751 666 -85 enable_IR_x2apic 279 191 -88 bpf_link_free 432 342 -90 synchronize_rcu 497 403 -94 identify_cpu 2665 2569 -96 ftrace_modify_all_code 355 258 -97 load_gs_index 212 104 -108 verity_end_io 369 257 -112 bpf_prog_detach 672 555 -117 __x2apic_send_IPI_mask 552 275 -277 snp_cleanup_vmsa 284 - -284 __noinstr_text_start 3072 1920 -1152 Total: Before=28577936, After=28558074, chg -0.07%
---
v2: use ASM_OUTPUT_RM (Uros Bizjak)
v1: https://lore.kernel.org/lkml/CANn89iJ+HKXRn7qF4KrT6gghw6CwWcsvoj8Scw17CkCqhGbk=A@mail.gmail.com/T/#mc2322d458f07118580eca7c5fa1f0bc931c32d30
arch/x86/include/asm/irqflags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/irqflags.h +0 -0
@@ -25,7 +25,7 @@ extern __always_inline unsigned long native_save_fl(void)
*/
asm volatile("# __raw_save_flags\n\t"
"pushf ; pop %0"
- : "=rm" (flags)
+ : ASM_OUTPUT_RM (flags)
: /* no input */
: "memory");--
2.52.0.322.g1dd061c0dc-goog
H. Peter Anvin
reviewerRe: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 129 lines · Eric Dumazet
clang is generating very inefficient code for
native_save_fl()which is used forlocal_irq_save()in critical spots.Allowing the "pop %0" to use memory:
1) forces the compiler to add annoying stack canaries when
CONFIG_STACKPROTECTOR_STRONG=yin many places.2) Almost always is followed by an immediate "move memory,register"
One good example is
_raw_spin_lock_irqsave, with 8 extra instructions
ffffffff82067a30<_raw_spin_lock_irqsave>:ffffffff82067a30: ...ffffffff82067a39: 53 push %rbx// Three instructions to ajust the stack, read the per-cpu canary // and copy it to 8(%rsp)
ffffffff82067a3a: 48 83 ec 10 sub $0x10,%rspffffffff82067a3e: 65 48 8b 05 da 15 45 02 mov %gs:0x24515da(%rip),%rax # <__stack_chk_guard>ffffffff82067a46: 48 89 44 24 08 mov %rax,0x8(%rsp)
ffffffff82067a4b: 9c pushf// instead of pop %rbx, compiler uses 2 instructions.
ffffffff82067a4c: 8f 04 24 pop (%rsp)ffffffff82067a4f: 48 8b 1c 24 mov (%rsp),%rbx
ffffffff82067a53: fa cliffffffff82067a54: b9 01 00 00 00 mov $0x1,%ecxffffffff82067a59: 31 c0 xor %eax,%eaxffffffff82067a5b: f0 0f b1 0f lock cmpxchg %ecx,(%rdi)ffffffff82067a5f: 75 1d jneffffffff82067a7e<_raw_spin_lock_irqsave+0x4e>// three instructions to check the stack canary
ffffffff82067a61: 65 48 8b 05 b7 15 45 02 mov %gs:0x24515b7(%rip),%rax # <__stack_chk_guard>ffffffff82067a69: 48 3b 44 24 08 cmp 0x8(%rsp),%raxffffffff82067a6e: 75 17 jneffffffff82067a87...
// One extra instruction to adjust the stack.
ffffffff82067a73: 48 83 c4 10 add $0x10,%rsp
...// One more instruction in case the stack was mangled.
ffffffff82067a87: e8 a4 35 ff ff callffffffff8205b030<__stack_chk_fail>This patch changes nothing for gcc, but for clang saves ~20000 bytes of text even though more functions are inlined.
$ size vmlinux.gcc.before vmlinux.gcc.after vmlinux.clang.before vmlinux.clang.after text data bss dec hex filename 45565821 25005462 4704800 75276083 47c9f33 vmlinux.gcc.before 45565821 25005462 4704800 75276083 47c9f33 vmlinux.gcc.after 45121072 24638617 5533040 75292729 47ce039 vmlinux.clang.before 45093887 24638633 5536808 75269328 47c84d0 vmlinux.clang.after$ scripts/bloat-o-meter -t vmlinux.clang.before vmlinux.clang.after add/remove: 1/2 grow/shrink: 21/533 up/down: 2250/-22112 (-19862) Function old new delta wakeup_cpu_via_vmgexit 1002 1447 +445 rcu_tasks_trace_pregp_step 1052 1454 +402 snp_kexec_finish 1290 1527 +237 check_all_holdout_tasks_trace 909 1106 +197 x2apic_send_IPI_mask_allbutself 38 198 +160 hpet_set_rtc_irq_bit 118 265 +147 x2apic_send_IPI_mask 38 184 +146 ring_buffer_poll_wait 261 405 +144 rb_watermark_hit 253 386 +133 __unlikely_text_end 368 416 +48 printk_trigger_flush 262 298 +36 __softirqentry_text_end - 32 +32 pstore_dump 1145 1164 +19 printk_legacy_allow_panic_sync 159 178 +19 netlink_insert 979 995 +16 console_try_replay_all 268 283 +15 do_flush_tlb_all 151 165 +14 __flush_tlb_all 151 165 +14 synchronize_rcu_expedited 2248 2259 +11 ... tcp_wfree 402 332 -70 stacktrace_trigger 133 62 -71 w1_touch_bit 418 343 -75 w1_triplet 446 370 -76 link_create 980 902 -78 drain_dead_softirq_workfn 425 347 -78 kcryptd_queue_crypt 253 174 -79 perf_event_aux_pause 448 368 -80 idle_worker_timeout 320 240 -80 srcu_funnel_exp_start 418 333 -85 call_rcu 751 666 -85 enable_IR_x2apic 279 191 -88 bpf_link_free 432 342 -90 synchronize_rcu 497 403 -94 identify_cpu 2665 2569 -96 ftrace_modify_all_code 355 258 -97 load_gs_index 212 104 -108 verity_end_io 369 257 -112 bpf_prog_detach 672 555 -117 __x2apic_send_IPI_mask 552 275 -277 snp_cleanup_vmsa 284 - -284 __noinstr_text_start 3072 1920 -1152 Total: Before=28577936, After=28558074, chg -0.07%Signed-off-by Eric Dumazet <[email protected]>Cc Uros Bizjak <[email protected]>Cc Linus Torvalds <[email protected]>---
v2: useASM_OUTPUT_RM(Uros Bizjak)
v1: https://lore.kernel.org/lkml/CANn89iJ+HKXRn7qF4KrT6gghw6CwWcsvoj8Scw17CkCqhGbk=A@mail.gmail.com/T/#mc2322d458f07118580eca7c5fa1f0bc931c32d30
arch/x86/include/asm/irqflags.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/irqflags.h +1
-2@@ -25,7 +25,7 @@ extern __always_inline unsigned long native_save_fl(void)*/ asm volatile("# __raw_save_flags\n\t" "pushf ; pop %0" - :"=rm" (flags) + : ASM_OUTPUT_RM (flags) : /* no input */ : "memory"); --
Quoted 2 lines
2.52.0.322.g1dd061c0dc-goog
Maybe they should provide an intrinsic for this operation?
Re: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 130 lines · H. Peter Anvin
Quoted 128 lines · Eric Dumazet
clang is generating very inefficient code for
native_save_fl()which is used forlocal_irq_save()in critical spots.Allowing the "pop %0" to use memory:
1) forces the compiler to add annoying stack canaries when
CONFIG_STACKPROTECTOR_STRONG=yin many places.2) Almost always is followed by an immediate "move memory,register"
One good example is
_raw_spin_lock_irqsave, with 8 extra instructions
ffffffff82067a30<_raw_spin_lock_irqsave>:ffffffff82067a30: ... ffffffff82067a39: 53 push %rbx// Three instructions to ajust the stack, read the per-cpu canary // and copy it to 8(%rsp)
ffffffff82067a3a: 48 83 ec 10 sub $0x10,%rsp ffffffff82067a3e: 65 48 8b 05 da 15 45 02 mov %gs:0x24515da(%rip),%rax # <__stack_chk_guard> ffffffff82067a46: 48 89 44 24 08 mov %rax,0x8(%rsp)
ffffffff82067a4b: 9c pushf// instead of pop %rbx, compiler uses 2 instructions.
ffffffff82067a4c: 8f 04 24 pop (%rsp) ffffffff82067a4f: 48 8b 1c 24 mov (%rsp),%rbxffffffff82067a53: fa cli ffffffff82067a54: b9 01 00 00 00 mov $0x1,%ecx ffffffff82067a59: 31 c0 xor %eax,%eax ffffffff82067a5b: f0 0f b1 0f lock cmpxchg %ecx,(%rdi) ffffffff82067a5f: 75 1d jne ffffffff82067a7e <_raw_spin_lock_irqsave+0x4e>// three instructions to check the stack canary
ffffffff82067a61: 65 48 8b 05 b7 15 45 02 mov %gs:0x24515b7(%rip),%rax # <__stack_chk_guard> ffffffff82067a69: 48 3b 44 24 08 cmp 0x8(%rsp),%rax ffffffff82067a6e: 75 17 jne ffffffff82067a87...
// One extra instruction to adjust the stack.
ffffffff82067a73: 48 83 c4 10 add $0x10,%rsp
...// One more instruction in case the stack was mangled.
ffffffff82067a87: e8 a4 35 ff ff callffffffff8205b030<__stack_chk_fail>This patch changes nothing for gcc, but for clang saves ~20000 bytes of text even though more functions are inlined.
$ size vmlinux.gcc.before vmlinux.gcc.after vmlinux.clang.before vmlinux.clang.after text data bss dec hex filename 45565821 25005462 4704800 75276083 47c9f33 vmlinux.gcc.before 45565821 25005462 4704800 75276083 47c9f33 vmlinux.gcc.after 45121072 24638617 5533040 75292729 47ce039 vmlinux.clang.before 45093887 24638633 5536808 75269328 47c84d0 vmlinux.clang.after$ scripts/bloat-o-meter -t vmlinux.clang.before vmlinux.clang.after add/remove: 1/2 grow/shrink: 21/533 up/down: 2250/-22112 (-19862) Function old new delta wakeup_cpu_via_vmgexit 1002 1447 +445 rcu_tasks_trace_pregp_step 1052 1454 +402 snp_kexec_finish 1290 1527 +237 check_all_holdout_tasks_trace 909 1106 +197 x2apic_send_IPI_mask_allbutself 38 198 +160 hpet_set_rtc_irq_bit 118 265 +147 x2apic_send_IPI_mask 38 184 +146 ring_buffer_poll_wait 261 405 +144 rb_watermark_hit 253 386 +133 __unlikely_text_end 368 416 +48 printk_trigger_flush 262 298 +36 __softirqentry_text_end - 32 +32 pstore_dump 1145 1164 +19 printk_legacy_allow_panic_sync 159 178 +19 netlink_insert 979 995 +16 console_try_replay_all 268 283 +15 do_flush_tlb_all 151 165 +14 __flush_tlb_all 151 165 +14 synchronize_rcu_expedited 2248 2259 +11 ... tcp_wfree 402 332 -70 stacktrace_trigger 133 62 -71 w1_touch_bit 418 343 -75 w1_triplet 446 370 -76 link_create 980 902 -78 drain_dead_softirq_workfn 425 347 -78 kcryptd_queue_crypt 253 174 -79 perf_event_aux_pause 448 368 -80 idle_worker_timeout 320 240 -80 srcu_funnel_exp_start 418 333 -85 call_rcu 751 666 -85 enable_IR_x2apic 279 191 -88 bpf_link_free 432 342 -90 synchronize_rcu 497 403 -94 identify_cpu 2665 2569 -96 ftrace_modify_all_code 355 258 -97 load_gs_index 212 104 -108 verity_end_io 369 257 -112 bpf_prog_detach 672 555 -117 __x2apic_send_IPI_mask 552 275 -277 snp_cleanup_vmsa 284 - -284 __noinstr_text_start 3072 1920 -1152 Total: Before=28577936, After=28558074, chg -0.07%Signed-off-by Eric Dumazet <[email protected]>Cc Uros Bizjak <[email protected]>Cc Linus Torvalds <[email protected]>---
v2: useASM_OUTPUT_RM(Uros Bizjak)
v1: https://lore.kernel.org/lkml/CANn89iJ+HKXRn7qF4KrT6gghw6CwWcsvoj8Scw17CkCqhGbk=A@mail.gmail.com/T/#mc2322d458f07118580eca7c5fa1f0bc931c32d30
arch/x86/include/asm/irqflags.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/irqflags.h +1
-1@@ -25,7 +25,7 @@ extern __always_inline unsigned long native_save_fl(void)*/ asmvolatile ("# __raw_save_flags\n\t" "pushf ; pop %0" - :"=rm" (flags) + : ASM_OUTPUT_RM (flags) : /* no input */ : "memory");
Quoted 5 lines
Quoted 3 lines
--
2.52.0.322.g1dd061c0dc-googMaybe they should provide an intrinsic for this operation?
They already do provide it, I mentioned this in V1 discussion:
https://lore.kernel.org/lkml/CANn89i+3F6O30Tg5kh-+O2nFa3xJMsverm1bTh-K1G0vk=-gig@mail.gmail.com/
Unfortunately I was told it was not better, some clang versions had bugs with it.
Re: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 3 lines · Eric Dumazet
Unfortunately I was told it was not better, some clang versions had bugs with it.
The whole "builtin is worse than inline asm" is actually a thing even when not actively buggy. We've had things like that a few times before.
It's why we have out own variable_ffs() implementation, for example, and do things like
#define ffs(x) (__builtin_constant_p(x) ? __builtin_ffs(x) : variable_ffs(x))
because __builtin_ffs() generates pointlessly silly code on at least some compiler versions:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106471
So then just using inline asm gets us at least reliable results, and we can - and do - tweak it for specific known configs.
Linus
H. Peter Anvin
reviewerRe: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 17 lines · Linus Torvalds
Quoted 3 lines · Eric Dumazet
Unfortunately I was told it was not better, some clang versions had bugs with it.
The whole "builtin is worse than inline asm" is actually a thing even when not actively buggy. We've had things like that a few times before.
It's why we have out own
variable_ffs()implementation, for example, and do things like#define ffs(x) (__builtin_constant_p(x) ? __builtin_ffs(x) : variable_ffs(x))because
__builtin_ffs()generates pointlessly silly code on at least some compiler versions:
Quoted 6 lines
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106471So then just using inline asm gets us at least reliable results, and we can - and do - tweak it for specific known configs.
Linus
Sigh.
It's just disappointing to see this kind of stuff.
Re: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 4 lines · H. Peter Anvin
Sigh.
It's just disappointing to see this kind of stuff.
I actually find all these builtins existing in the first place more disappointing.
Inline asm is the *generic* answer, and the one that works for pretty much any situation. It's required in the general case, and it's the thing that works with older compilers.
Having a builtin for things like this - without any appreciable improvement in code - is just pointless and stupid.
Now, generic cross-architecture builtins are one thing: then you can use them "portably". So having a builtin for 'ffs()' is not wrong.
But something like __builtin_ia32_readeflags_u64() is just entirely pointless. What is the supposed advantage over just doing inline assembly?
Linus
H. Peter Anvin
reviewerRe: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 16 lines · Linus Torvalds
Quoted 4 lines · H. Peter Anvin
Sigh.
It's just disappointing to see this kind of stuff.
I actually find all these builtins existing in the first place more disappointing.
Inline asm is the *generic* answer, and the one that works for pretty much any situation. It's required in the general case, and it's the thing that works with older compilers.
Having a builtin for things like this - without any appreciable improvement in code - is just pointless and stupid.
Quoted 8 lines
Now, generic cross-architecture builtins are one thing: then you can use them "portably". So having a builtin for '
ffs()' is not wrong.But something like
__builtin_ia32_readeflags_u64()is just entirely pointless. What is the supposed advantage over just doing inline assembly?Linus
Unless they are doing something like actually leaving it on the stack... yeah.
Re: [PATCH 2/2] x86/irqflags: Use ASM_OUTPUT_RM in native_save_fl()
Quoted 5 lines
Quoted 3 lines
But something like
__builtin_ia32_readeflags_u64()is just entirely pointless. What is the supposed advantage over just doing inline assembly?Unless they are doing something like actually leaving it on the stack... yeah.
It's not just pointless, it's actively dangerous.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104971
At least with inline assembly, it's the programmer's fault when making a mistake like this.
~Andrew