196263Sobrien/* 296263Sobrien * Copyright (C) 2001 Free Software Foundation, Inc. 396263Sobrien * Contributed by David S. Miller (davem@redhat.com) 496263Sobrien * 596263Sobrien * This file is free software; you can redistribute it and/or modify it 696263Sobrien * under the terms of the GNU General Public License as published by the 796263Sobrien * Free Software Foundation; either version 2, or (at your option) any 896263Sobrien * later version. 996263Sobrien * 1096263Sobrien * In addition to the permissions in the GNU General Public License, the 1196263Sobrien * Free Software Foundation gives you unlimited permission to link the 1296263Sobrien * compiled version of this file with other programs, and to distribute 1396263Sobrien * those programs without any restriction coming from the use of this 1496263Sobrien * file. (The General Public License restrictions do apply in other 1596263Sobrien * respects; for example, they cover modification of the file, and 1696263Sobrien * distribution when not linked into another program.) 1796263Sobrien * 1896263Sobrien * This file is distributed in the hope that it will be useful, but 1996263Sobrien * WITHOUT ANY WARRANTY; without even the implied warranty of 2096263Sobrien * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2196263Sobrien * General Public License for more details. 2296263Sobrien * 2396263Sobrien * You should have received a copy of the GNU General Public License 2496263Sobrien * along with this program; see the file COPYING. If not, write to 25169689Skan * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 26169689Skan * Boston, MA 02110-1301, USA. 2796263Sobrien * 2896263Sobrien * As a special exception, if you link this library with files 2996263Sobrien * compiled with GCC to produce an executable, this does not cause 3096263Sobrien * the resulting executable to be covered by the GNU General Public License. 3196263Sobrien * This exception does not however invalidate any other reasons why 3296263Sobrien * the executable file might be covered by the GNU General Public License. 3396263Sobrien */ 3496263Sobrien 3596263Sobrien#define FPRS_NS (1 << 22) /* Non-Standard fpu results */ 3696263Sobrien 3796263Sobrienstatic void __attribute__((constructor)) 3896263Sobrienset_fast_math (void) 3996263Sobrien{ 4096263Sobrien unsigned int fsr; 4196263Sobrien 4296263Sobrien /* This works for the 64-bit case because, even if 32-bit ld/st of 4396263Sobrien the fsr register modified the upper 32-bit, the only thing up there 4496263Sobrien are the 3 other condition codes which are "do not care" at the time 4596263Sobrien that this runs. */ 4696263Sobrien 4796263Sobrien __asm__("st %%fsr, %0" 4896263Sobrien : "=m" (fsr)); 4996263Sobrien 5096263Sobrien fsr |= FPRS_NS; 5196263Sobrien 5296263Sobrien __asm__("ld %0, %%fsr" 5396263Sobrien : : "m" (fsr)); 5496263Sobrien} 55