glibc/sysdeps/unix/sysv/linux
Joseph Myers ec94343f59 Add femode_t functions.
TS 18661-1 defines a type femode_t to represent the set of dynamic
floating-point control modes (such as the rounding mode and trap
enablement modes), and functions fegetmode and fesetmode to manipulate
those modes (without affecting other state such as the raised
exception flags) and a corresponding macro FE_DFL_MODE.

This patch series implements those interfaces for glibc.  This first
patch adds the architecture-independent pieces, the x86 and x86_64
implementations, and the <bits/fenv.h> and ABI baseline updates for
all architectures so glibc keeps building and passing the ABI tests on
all architectures.  Subsequent patches add the fegetmode and fesetmode
implementations for other architectures.

femode_t is generally an integer type - the same type as fenv_t, or as
the single element of fenv_t where fenv_t is a structure containing a
single integer (or the single relevant element, where it has elements
for both status and control registers) - except where architecture
properties or consistency with the fenv_t implementation indicate
otherwise.  FE_DFL_MODE follows FE_DFL_ENV in whether it's a magic
pointer value (-1 cast to const femode_t *), a value that can be
distinguished from valid pointers by its high bits but otherwise
contains a representation of the desired register contents, or a
pointer to a constant variable (the powerpc case; __fe_dfl_mode is
added as an exported constant object, an alias to __fe_dfl_env).

Note that where architectures (that share a register between control
and status bits) gain definitions of new floating-point control or
status bits in future, the implementations of fesetmode for those
architectures may need updating (depending on whether the new bits are
control or status bits and what the implementation does with
previously unknown bits), just like existing implementations of
<fenv.h> functions that take care not to touch reserved bits may need
updating when the set of reserved bits changes.  (As any new bits are
outside the scope of ISO C, that's just a quality-of-implementation
issue for supporting them, not a conformance issue.)

As with fenv_t, femode_t should properly include any software DFP
rounding mode (and for both fenv_t and femode_t I'd consider that
fragment of DFP support appropriate for inclusion in glibc even in the
absence of the rest of libdfp; hardware DFP rounding modes should
already be included if the definitions of which bits are status /
control bits are correct).

Tested for x86_64, x86, mips64 (hard float, and soft float to test the
fallback version), arm (hard float) and powerpc (hard float, soft
float and e500).  Other architecture versions are untested.

	* math/fegetmode.c: New file.
	* math/fesetmode.c: Likewise.
	* sysdeps/i386/fpu/fegetmode.c: Likewise.
	* sysdeps/i386/fpu/fesetmode.c: Likewise.
	* sysdeps/x86_64/fpu/fegetmode.c: Likewise.
	* sysdeps/x86_64/fpu/fesetmode.c: Likewise.
	* math/fenv.h: Update comment on inclusion of <bits/fenv.h>.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fegetmode): New function
	declaration.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetmode): Likewise.
	* bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (femode_t): New
	typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/aarch64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/alpha/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/arm/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/hppa/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/ia64/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/m68k/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/microblaze/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/mips/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/nios2/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/powerpc/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (__fe_dfl_mode): New variable
	declaration.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/s390/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/sh/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/sparc/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/tile/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* sysdeps/x86/fpu/bits/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(femode_t): New typedef.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (FE_DFL_MODE): New macro.
	* manual/arith.texi (FE_DFL_MODE): Document macro.
	(fegetmode): Document function.
	(fesetmode): Likewise.
	* math/Versions (fegetmode): New libm symbol at version
	GLIBC_2.25.
	(fesetmode): Likewise.
	* math/Makefile (libm-support): Add fegetmode and fesetmode.
	(tests): Add test-femode and test-femode-traps.
	* math/test-femode-traps.c: New file.
	* math/test-femode.c: Likewise.
	* sysdeps/powerpc/fpu/fenv_const.c (__fe_dfl_mode): Declare as
	alias for __fe_dfl_env.
	* sysdeps/powerpc/nofpu/fenv_const.c (__fe_dfl_mode): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_const.c
	(__fe_dfl_mode): Likewise.
	* sysdeps/powerpc/Versions (__fe_dfl_mode): New libm symbol at
	version GLIBC_2.25.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2016-09-07 16:40:09 +00:00
..
aarch64 Add femode_t functions. 2016-09-07 16:40:09 +00:00
alpha Add femode_t functions. 2016-09-07 16:40:09 +00:00
arm Add femode_t functions. 2016-09-07 16:40:09 +00:00
bits Define PF_QIPCRTR, AF_QIPCRTR from Linux 4.7 in bits/socket.h. 2016-08-03 12:12:22 +00:00
generic Consolidate pwritev/pwritev64 implementations 2016-06-06 19:12:36 -03:00
hppa Add femode_t functions. 2016-09-07 16:40:09 +00:00
i386 Add femode_t functions. 2016-09-07 16:40:09 +00:00
ia64 Add femode_t functions. 2016-09-07 16:40:09 +00:00
include/sys
m68k Add femode_t functions. 2016-09-07 16:40:09 +00:00
microblaze Add femode_t functions. 2016-09-07 16:40:09 +00:00
mips Add femode_t functions. 2016-09-07 16:40:09 +00:00
net
netash
netatalk
netax25
neteconet
netinet
netipx
netiucv Add missing iucv related defines. 2016-04-27 09:08:29 +02:00
netpacket
netrom
netrose
nfs
nios2 Add femode_t functions. 2016-09-07 16:40:09 +00:00
powerpc Add femode_t functions. 2016-09-07 16:40:09 +00:00
s390 Add femode_t functions. 2016-09-07 16:40:09 +00:00
scsi
sh Add femode_t functions. 2016-09-07 16:40:09 +00:00
sparc Add femode_t functions. 2016-09-07 16:40:09 +00:00
sys Base <sys/quota.h> on Linux kernel headers [BZ #20525] 2016-09-01 15:53:13 +02:00
tile Add femode_t functions. 2016-09-07 16:40:09 +00:00
wordsize-64 Consolidate pwritev/pwritev64 implementations 2016-06-06 19:12:36 -03:00
x86
x86_64 Add femode_t functions. 2016-09-07 16:40:09 +00:00
Implies
Makefile Base <sys/quota.h> on Linux kernel headers [BZ #20525] 2016-09-01 15:53:13 +02:00
Versions
_G_config.h
_exit.c
a.out.h
accept.c
accept4.c
adjtime.c
aio_misc.h
aio_sigqueue.c
arch-fork.h
bind.c
check_native.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
check_pf.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
clock.c
clock_getcpuclockid.c
clock_getres.c
clock_gettime.c
clock_nanosleep.c
clock_settime.c
cmsg_nxthdr.c
configure Remove linux/fanotify.h configure test. 2016-02-24 18:44:10 +00:00
configure.ac Remove linux/fanotify.h configure test. 2016-02-24 18:44:10 +00:00
connect.c
createthread.c
default-sched.h
device-nrs.h
dl-brk.c
dl-execstack.c
dl-fxstatat64.c
dl-getcwd.c
dl-librecon.h
dl-openat64.c Assume __NR_openat is always defined 2016-03-23 23:35:08 +01:00
dl-opendir.c
dl-origin.c
dl-osinfo.h
dl-sbrk.c
dl-sysdep.c
dl-sysdep.h
dl-vdso.c
dl-vdso.h
dl-writev.h
epoll_pwait.c
errqueue.h
eventfd_read.c
eventfd_write.c
exit-thread.h
faccessat.c
fallocate.c
fallocate64.c
fatal-prepare.h
fchmodat.c
fcntl.c
fd_to_filename.h
fexecve.c
fips-private.h
fpathconf.c
fstatfs64.c
fstatvfs.c
fstatvfs64.c
ftime.c
ftruncate64.c
futex-internal.h
futimens.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
futimes.c
futimesat.c
fxstat.c
fxstat64.c
fxstatat.c
fxstatat64.c
gai_sigqueue.c
getclktck.c
getcwd.c
getdents.c Remove __ASSUME_GETDENTS64_SYSCALL. 2016-03-22 00:32:20 +00:00
getdents64.c
getdirentries.c
getdirentries64.c
getdtsz.c
gethostid.c
getipv4sourcefilter.c
getloadavg.c
getlogin.c
getlogin_r.c
getpagesize.c
getpeername.c
getpid.c
getpriority.c
getpt.c
getrlimit64.c
getsockname.c
getsockopt.c
getsourcefilter.c
getsysstats.c
gettimeofday.c
grantpt.c
if_index.c
ifaddrs.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
ifreq.c
internal_statvfs.c
internal_statvfs64.c
ipc_priv.h
kernel-features.h Remove __ASSUME_FUTEX_LOCK_PI 2016-06-13 08:36:34 -03:00
kernel-posix-cpu-timers.h
kernel-posix-timers.h
kernel_sigaction.h
kernel_stat.h
kernel_termios.h
ldd-rewrite.sed
lddlibc4.c
ldsodefs.h Fix build with HAVE_AUX_VECTOR 2016-04-11 10:27:25 +02:00
libc_fatal.c
linux_fsinfo.h
listen.c
llseek.c
local-setxid.h
lowlevellock-futex.h
lseek64.c
lutimes.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
lxstat.c
lxstat64.c
malloc-sysdep.h
mmap64.c
mq_close.c
mq_getattr.c
mq_notify.c
mq_open.c
mq_receive.c
mq_send.c
mq_unlink.c
msgctl.c
msgget.c
msgrcv.c
msgsnd.c
netlink_assert_response.c
netlinkaccess.h
nice.c
not-cancel.h
nptl-signals.h Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
nscd_setup_thread.c
ntp_gettime.c
ntp_gettimex.c
open64.c
openat.c
openat64.c
opendir.c
opensock.c
pathconf.c
pathconf.h
paths.h
personality.c
posix_fadvise.c
posix_fadvise64.c
posix_fallocate.c
posix_fallocate64.c
posix_madvise.c
ppoll.c Remove __ASSUME_PPOLL. 2016-03-15 21:11:07 +00:00
pread.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
pread64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
preadv.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
preadv64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
prlimit.c
prof-freq.c
profil.c
pselect.c
pt-raise.c Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
pthread-pids.h
pthread_getaffinity.c
pthread_getcpuclockid.c
pthread_getname.c
pthread_kill.c
pthread_setaffinity.c
pthread_setname.c
pthread_sigmask.c
pthread_sigqueue.c
ptrace.c
ptsname.c
pwrite.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
pwrite64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
pwritev.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
pwritev64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
raise.c Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
readahead.c
readdir64.c
readdir64_r.c
readonly-area.c
reboot.c
recv.c
recvfrom.c
recvmmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
recvmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
remove.c
sa_len.c
safe-fatal.h
sched_getaffinity.c
sched_getcpu.c
sched_setaffinity.c
segfault.c
semctl.c
semget.c
semop.c
semtimedop.c
send.c
sendmmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
sendmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
sendto.c
setegid.c
seteuid.c
setgid.c
setgroups.c
sethostid.c
setipv4sourcefilter.c
setregid.c
setresgid.c
setresuid.c
setreuid.c
setrlimit64.c
setsockopt.c
setsourcefilter.c
setuid.c
shlib-versions
shm-directory.c
shmat.c
shmctl.c
shmdt.c
shmget.c
shutdown.c
sigaction.c
siglist.h
signal.c
signalfd.c Remove __ASSUME_SIGNALFD4. 2016-03-21 16:30:05 +00:00
sigpending.c
sigprocmask.c
sigqueue.c
sigreturn.c
sigset-cvt-mask.h
sigstack.c
sigsuspend.c
sigtimedwait.c
sigwait.c
sigwaitinfo.c
sizes.h
socket.c
socketcall.h
socketpair.c
spawni.c posix: Call _exit in failure case for posix_spawn{p} (BZ#20178) 2016-05-30 10:56:01 -03:00
speed.c
statfs64.c
statvfs.c
statvfs64.c
sync_file_range.c
syscalls.list Remove __ASSUME_EVENTFD2, move eventfd to syscalls.list. 2016-03-17 19:07:39 +00:00
sysconf.c
sysctl.c
sysctl.mk
sysdep-vdso.h
sysdep.h Fix LO_HI_LONG definition 2016-07-08 15:41:21 -03:00
syslog.c
system.c
tcdrain.c
tcflow.c
tcflush.c
tcgetattr.c
tcgetpgrp.c
tcsendbrk.c
tcsetattr.c
tcsetpgrp.c
termio.h
time.c
timer_create.c
timer_delete.c
timer_getoverr.c
timer_gettime.c
timer_routines.c
timer_settime.c
times.c Expand comments in Linux times() implementation. 2016-06-19 15:47:00 -04:00
timespec_get.c
truncate64.c
tst-affinity-pid.c
tst-affinity.c
tst-align-clone.c
tst-clone.c
tst-clone2.c Fix clone (CLONE_VM) pid/tid reset (BZ#19957) 2016-04-29 18:19:30 -03:00
tst-fanotify.c Remove linux/fanotify.h configure test. 2016-02-24 18:44:10 +00:00
tst-getpid1.c
tst-personality.c
tst-quota.c Base <sys/quota.h> on Linux kernel headers [BZ #20525] 2016-09-01 15:53:13 +02:00
tst-setgetname.c
tst-skeleton-affinity.c
tst-skeleton-thread-affinity.c
tst-thread-affinity-pthread.c
tst-thread-affinity-pthread2.c
tst-thread-affinity-sched.c
ttyname.c
ttyname_r.c
ualarm.c
umount.S
umount2.S
unlockpt.c
updwtmp.c
ustat.c
utimensat.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
utimes.c
utmp_file.c
vfork.c
wait.c Remove union wait [BZ #19613] 2016-04-14 08:54:57 +02:00
wait3.c
waitid.c
waitpid.c
xmknod.c
xmknodat.c
xstat.c
xstat64.c
xstatconv.c
xstatconv.h