This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Do not raise "inexact" from x86_64 SSE4.1 ceil, floor (bug 15479) [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Tue, 24 May 2016 21:12:37 +0000
- Subject: Do not raise "inexact" from x86_64 SSE4.1 ceil, floor (bug 15479) [committed]
- Authentication-results: sourceware.org; auth=none
Continuing fixes for ceil and floor functions not to raise the
"inexact" exception, this patch fixes the x86_64 SSE4.1 versions. The
roundss / roundsd instructions take an immediate operand that
determines the rounding mode and whether to raise "inexact"; this just
needs bit 3 set to disable "inexact", which this patch does.
Remark: we don't have an SSE4.1 version of trunc / truncf (using this
instruction with operand 11); I'd expect one to make sense, but of
course it should be benchmarked against the existing C code. I'll
file a bug in Bugzilla for the lack of such a version.
Tested for x86_64. Committed.
2016-05-24 Joseph Myers <joseph@codesourcery.com>
[BZ #15479]
* sysdeps/x86_64/fpu/multiarch/s_ceil.S (__ceil_sse41): Set bit 3
of immediate operand to rounding instruction.
* sysdeps/x86_64/fpu/multiarch/s_ceilf.S (__ceilf_sse41):
Likewise.
* sysdeps/x86_64/fpu/multiarch/s_floor.S (__floor_sse41):
Likewise.
* sysdeps/x86_64/fpu/multiarch/s_floorf.S (__floorf_sse41):
Likewise.
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceil.S b/sysdeps/x86_64/fpu/multiarch/s_ceil.S
index 40fa729..f2ca31e 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_ceil.S
+++ b/sysdeps/x86_64/fpu/multiarch/s_ceil.S
@@ -33,6 +33,6 @@ weak_alias (__ceil, ceil)
ENTRY(__ceil_sse41)
- roundsd $2, %xmm0, %xmm0
+ roundsd $10, %xmm0, %xmm0
ret
END(__ceil_sse41)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_ceilf.S b/sysdeps/x86_64/fpu/multiarch/s_ceilf.S
index 9a06a5c..e7a7b3a 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_ceilf.S
+++ b/sysdeps/x86_64/fpu/multiarch/s_ceilf.S
@@ -33,6 +33,6 @@ weak_alias (__ceilf, ceilf)
ENTRY(__ceilf_sse41)
- roundss $2, %xmm0, %xmm0
+ roundss $10, %xmm0, %xmm0
ret
END(__ceilf_sse41)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floor.S b/sysdeps/x86_64/fpu/multiarch/s_floor.S
index 57a0eee..19c0d44 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_floor.S
+++ b/sysdeps/x86_64/fpu/multiarch/s_floor.S
@@ -33,6 +33,6 @@ weak_alias (__floor, floor)
ENTRY(__floor_sse41)
- roundsd $1, %xmm0, %xmm0
+ roundsd $9, %xmm0, %xmm0
ret
END(__floor_sse41)
diff --git a/sysdeps/x86_64/fpu/multiarch/s_floorf.S b/sysdeps/x86_64/fpu/multiarch/s_floorf.S
index 74a149a..96f51b6 100644
--- a/sysdeps/x86_64/fpu/multiarch/s_floorf.S
+++ b/sysdeps/x86_64/fpu/multiarch/s_floorf.S
@@ -33,6 +33,6 @@ weak_alias (__floorf, floorf)
ENTRY(__floorf_sse41)
- roundss $1, %xmm0, %xmm0
+ roundss $9, %xmm0, %xmm0
ret
END(__floorf_sse41)
--
Joseph S. Myers
joseph@codesourcery.com