Sourceware Bugzilla – Attachment 6996 Details for
Bug 15384
One constant fewer in ieee754/dbl-64/wordsize-64/s_finite.c
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
benchmark for inlines
test.c (text/x-csrc), 2.17 KB, created by
OndrejBilka
on 2013-04-22 08:32:07 UTC
(
hide
)
Description:
benchmark for inlines
Filename:
MIME Type:
Creator:
OndrejBilka
Created:
2013-04-22 08:32:07 UTC
Size:
2.17 KB
patch
obsolete
>#include <stdint.h> >#include <math.h> >#if defined __AVX__ || defined SSE2AVX ># define MOVD "vmovd" >#else ># define MOVD "movd" >#endif >#define EXTRACT_WORDS64(i, d) \ > do { \ > int64_t i_; \ > asm (MOVD " %1, %0" : "=rm" (i_) : "x" ((double) (d))); \ > (i) = i_; \ > } while (0) >typedef union >{ > double value; > struct > { > uint32_t lsw; > uint32_t msw; > } parts; > uint64_t word; >} ieee_double_shape_type; ># define GET_HIGH_WORD(i,d) \ > do { \ > ieee_double_shape_type gh_u; \ > gh_u.value = (d); \ > (i) = gh_u.parts.msw; \ > } while (0) > >int finite0(double x) >{ > int32_t hx; > GET_HIGH_WORD(hx,x); > return (int)((uint32_t)((hx&0x7fffffff)-0x7ff00000)>>31); >} >int finite1(double x) >{ > int32_t hx; > GET_HIGH_WORD(hx,x); > return (int)((uint32_t)((hx&0x7ff00000)-0x7ff00000)>>31); >} >int finite2(double x) >{ > int64_t lx; > EXTRACT_WORDS64(lx,x); > return (int)((uint64_t)((lx&INT64_C(0x7ff0000000000000))-INT64_C(0x7ff0000000000000))>>63); >} >uint64_t finite3(double x) >{ > int64_t lx; > EXTRACT_WORDS64(lx,x); > return (lx&INT64_C(0x7ff0000000000000))!=INT64_C(0x7ff0000000000000); >} >int finite4(double x) >{ > uint64_t lx; > EXTRACT_WORDS64(lx,x); > lx=lx>>52; > return ((lx&0x7ff)!=0x7ff); > >} >int finite5(double x) >{ > double y=x-x; > return y==y; >} >int finite6(double x) >{ > return __builtin_finite(x); >} > > >int finite7(double x) >{ > uint64_t lx; > EXTRACT_WORDS64(lx,x); > lx=lx>>52; > return (((lx+1)&0x7ff)); >} > >double finite_wrap(double x) __attribute__((noinline,noclone)); >double finite_wrap(double x){ > if(finite(x)) return 0; > else return x; >} > >int main(){ > > int i; > int r; > double x=3; > double cnt=0; > for(i=0;i<100000000;i++) { > cnt+=finite_wrap(x); > x+=0.323; > } > if (cnt==1) > return 1; > else return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 15384
:
6991
|
6992
|
6993
|
6994
|
6995
| 6996