From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7717 invoked by alias); 16 Oct 2014 12:12:21 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7667 invoked by uid 48); 16 Oct 2014 12:12:15 -0000 From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/53513] [SH] Add support for fschg and fpchg insns and improve fenv support Date: Thu, 16 Oct 2014 12:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-10/txt/msg01252.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53513 --- Comment #32 from Oleg Endo --- As a next step, I'd like to add built-in functions to get/set the FPSCR on SH. We have the old __get_fpscr and __set_fpscr functions in libgcc which modify the __fpscr_values array and the FPSCR. One idea would be to make __get_fpscr and __set_fpscr built-in functions, so that new code never generates the respective library calls. I don't know how expected/unexpected that would be for users and their existing code. For example, the current glibc does this in sysdeps/sh/sh4/fpu/fpu_control.h: #if defined __GNUC__ __BEGIN_DECLS /* GCC provides this function. */ extern void __set_fpscr (unsigned long); #define _FPU_SETCW(cw) __set_fpscr ((cw)) #else #define _FPU_SETCW(cw) __asm__ ("lds %0,fpscr" : : "r" (cw)) #endif By making __set_fpscr a builtin it would automagically work, but would never update the __fpscr_values. I'm not sure what kind of other fpscr related work arounds build on top of that. Alternatively, we could name the built-in functions differently. I've briefly checked the docs of other targets, this is what I've found: aarch64: unsigned int __builtin_aarch64_get_fpcr () void __builtin_aarch64_set_fpcr (unsigned int) unsigned int __builtin_aarch64_get_fpsr () void __builtin_aarch64_set_fpsr (unsigned int) ARM: unsigned int __builtin_arm_get_fpscr () void __builtin_arm_set_fpscr (unsigned int) MIPS: unsigned int __builtin_mips_get_fcsr (void) void __builtin_mips_set_fcsr (unsigned int value) I'd propose the following for SH: unsigned int __builtin_sh_get_fpscr () void __builtin_sh_set_fpscr (unsigned int) Any opinions or feedback regarding the matter?