1/* 2 * Copyright (C) 2001 Free Software Foundation, Inc. 3 * Contributed by David S. Miller (davem@redhat.com) 4 * 5 * This file is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 2, or (at your option) any 8 * later version. 9 * 10 * In addition to the permissions in the GNU General Public License, the 11 * Free Software Foundation gives you unlimited permission to link the 12 * compiled version of this file with other programs, and to distribute 13 * those programs without any restriction coming from the use of this 14 * file. (The General Public License restrictions do apply in other 15 * respects; for example, they cover modification of the file, and 16 * distribution when not linked into another program.) 17 * 18 * This file is distributed in the hope that it will be useful, but 19 * WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 * General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with this program; see the file COPYING. If not, write to 25 * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 26 * Boston, MA 02110-1301, USA. 27 * 28 * As a special exception, if you link this library with files 29 * compiled with GCC to produce an executable, this does not cause 30 * the resulting executable to be covered by the GNU General Public License. 31 * This exception does not however invalidate any other reasons why 32 * the executable file might be covered by the GNU General Public License. 33 */ 34 35#define FPRS_NS (1 << 22) /* Non-Standard fpu results */ 36 37static void __attribute__((constructor)) 38set_fast_math (void) 39{ 40 unsigned int fsr; 41 42 /* This works for the 64-bit case because, even if 32-bit ld/st of 43 the fsr register modified the upper 32-bit, the only thing up there 44 are the 3 other condition codes which are "do not care" at the time 45 that this runs. */ 46 47 __asm__("st %%fsr, %0" 48 : "=m" (fsr)); 49 50 fsr |= FPRS_NS; 51 52 __asm__("ld %0, %%fsr" 53 : : "m" (fsr)); 54} 55