public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/67648] New: No need to save callee-saved registers in interrupt handler
@ 2015-09-20 14:10 hjl.tools at gmail dot com
2015-09-20 14:43 ` [Bug other/67648] " hjl.tools at gmail dot com
2015-09-20 22:16 ` hjl.tools at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2015-09-20 14:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67648
Bug ID: 67648
Summary: No need to save callee-saved registers in interrupt
handler
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: julia.koval at intel dot com
Blocks: 67552
Target Milestone: ---
[hjl@gnu-6 interrupt-1]$ cat call-1.i
extern void bar (void);
void
__attribute__ ((interrupt))
foo (void)
{
bar ();
}
[hjl@gnu-6 interrupt-1]$ make call-1.s
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -S -o call-1.s call-1.i
[hjl@gnu-6 interrupt-1]$ cat call-1.s
.file "call-1.i"
.section .text.unlikely,"ax",@progbits
.LCOLDB0:
.text
.LHOTB0:
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
pushq %r15
.cfi_def_cfa_offset 16
.cfi_offset 15, -16
pushq %r14
.cfi_def_cfa_offset 24
.cfi_offset 14, -24
pushq %r13
.cfi_def_cfa_offset 32
.cfi_offset 13, -32
pushq %r12
.cfi_def_cfa_offset 40
.cfi_offset 12, -40
pushq %r11
.cfi_def_cfa_offset 48
.cfi_offset 11, -48
pushq %r10
.cfi_def_cfa_offset 56
.cfi_offset 10, -56
pushq %r9
.cfi_def_cfa_offset 64
.cfi_offset 9, -64
pushq %r8
.cfi_def_cfa_offset 72
.cfi_offset 8, -72
pushq %rbp
.cfi_def_cfa_offset 80
.cfi_offset 6, -80
pushq %rdi
.cfi_def_cfa_offset 88
.cfi_offset 5, -88
pushq %rsi
.cfi_def_cfa_offset 96
.cfi_offset 4, -96
pushq %rbx
.cfi_def_cfa_offset 104
.cfi_offset 3, -104
pushq %rcx
.cfi_def_cfa_offset 112
.cfi_offset 2, -112
pushq %rdx
.cfi_def_cfa_offset 120
.cfi_offset 1, -120
pushq %rax
.cfi_def_cfa_offset 128
.cfi_offset 0, -128
subq $256, %rsp
.cfi_def_cfa_offset 384
movups %xmm0, (%rsp)
movups %xmm1, 16(%rsp)
movups %xmm2, 32(%rsp)
movups %xmm3, 48(%rsp)
movups %xmm4, 64(%rsp)
movups %xmm5, 80(%rsp)
movups %xmm6, 96(%rsp)
movups %xmm7, 112(%rsp)
movups %xmm8, 128(%rsp)
movups %xmm9, 144(%rsp)
movups %xmm10, 160(%rsp)
movups %xmm11, 176(%rsp)
movups %xmm12, 192(%rsp)
movups %xmm13, 208(%rsp)
movups %xmm14, 224(%rsp)
movups %xmm15, 240(%rsp)
.cfi_offset 17, -384
.cfi_offset 18, -368
.cfi_offset 19, -352
.cfi_offset 20, -336
.cfi_offset 21, -320
.cfi_offset 22, -304
.cfi_offset 23, -288
.cfi_offset 24, -272
.cfi_offset 25, -256
.cfi_offset 26, -240
.cfi_offset 27, -224
.cfi_offset 28, -208
.cfi_offset 29, -192
.cfi_offset 30, -176
.cfi_offset 31, -160
.cfi_offset 32, -144
call bar
movups (%rsp), %xmm0
movups 16(%rsp), %xmm1
movups 32(%rsp), %xmm2
movups 48(%rsp), %xmm3
movups 64(%rsp), %xmm4
movups 80(%rsp), %xmm5
movups 96(%rsp), %xmm6
movups 112(%rsp), %xmm7
movups 128(%rsp), %xmm8
movups 144(%rsp), %xmm9
movups 160(%rsp), %xmm10
movups 176(%rsp), %xmm11
movups 192(%rsp), %xmm12
movups 208(%rsp), %xmm13
movups 224(%rsp), %xmm14
movups 240(%rsp), %xmm15
addq $256, %rsp
.cfi_restore 32
.cfi_restore 31
.cfi_restore 30
.cfi_restore 29
.cfi_restore 28
.cfi_restore 27
.cfi_restore 26
.cfi_restore 25
.cfi_restore 24
.cfi_restore 23
.cfi_restore 22
.cfi_restore 21
.cfi_restore 20
.cfi_restore 19
.cfi_restore 18
.cfi_restore 17
.cfi_def_cfa_offset 128
popq %rax
.cfi_def_cfa_offset 120
popq %rdx
.cfi_def_cfa_offset 112
popq %rcx
.cfi_def_cfa_offset 104
popq %rbx
.cfi_def_cfa_offset 96
popq %rsi
.cfi_def_cfa_offset 88
popq %rdi
.cfi_def_cfa_offset 80
popq %rbp
.cfi_def_cfa_offset 72
popq %r8
.cfi_def_cfa_offset 64
popq %r9
.cfi_def_cfa_offset 56
popq %r10
.cfi_def_cfa_offset 48
popq %r11
.cfi_def_cfa_offset 40
popq %r12
.cfi_def_cfa_offset 32
popq %r13
.cfi_def_cfa_offset 24
popq %r14
.cfi_def_cfa_offset 16
popq %r15
.cfi_def_cfa_offset 8
iret
.cfi_endproc
.LFE0:
.size foo, .-foo
.section .text.unlikely
.LCOLDE0:
.text
.LHOTE0:
.ident "GCC: (GNU) 6.0.0 20150917 (experimental)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 interrupt-1]$
Since RBX and R12-R15 registers are callee-saved, we don't need
to save and restore them in interrupt handler unless they are
modified.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67552
[Bug 67552] [meta] x86 interrupt attribute
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug other/67648] No need to save callee-saved registers in interrupt handler
2015-09-20 14:10 [Bug other/67648] New: No need to save callee-saved registers in interrupt handler hjl.tools at gmail dot com
@ 2015-09-20 14:43 ` hjl.tools at gmail dot com
2015-09-20 22:16 ` hjl.tools at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2015-09-20 14:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67648
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |6.0
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Julia, we should avoid changing call_used_regs in
ix86_conditional_register_usage. Instead, we should
only save and restore caller-saved registers changed by
interrupt handler.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug other/67648] No need to save callee-saved registers in interrupt handler
2015-09-20 14:10 [Bug other/67648] New: No need to save callee-saved registers in interrupt handler hjl.tools at gmail dot com
2015-09-20 14:43 ` [Bug other/67648] " hjl.tools at gmail dot com
@ 2015-09-20 22:16 ` hjl.tools at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: hjl.tools at gmail dot com @ 2015-09-20 22:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67648
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
I checked a fix into hjl/interrupt/master branch:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b21f445ed3e067ac1b401798b953a1ec5b093202
Please take a look.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-20 22:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-20 14:10 [Bug other/67648] New: No need to save callee-saved registers in interrupt handler hjl.tools at gmail dot com
2015-09-20 14:43 ` [Bug other/67648] " hjl.tools at gmail dot com
2015-09-20 22:16 ` hjl.tools at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).