pgsql: Fix portability issues in pg_bitutils

2019-02-13 Thread Alvaro Herrera
Fix portability issues in pg_bitutils We were using uint64 function arguments as "long int" arguments to compiler builtins, which fails on machines where long ints are 32 bits: the upper half of the uint64 was being ignored. Fix by using the "ll" builtin variants instead, which on those machines

Re: pgsql: Change floating-point output format for improved performance.

2019-02-13 Thread Andrew Gierth
> "Andrew" == Andrew Dunstan writes: >>> Cross-version upgrade is the big problem; I have no real idea how to >>> make that test work short of adding another GUC; revert? >> Andrew Dunstan might be able to help, although I'm not immediately >> sure how... Andrew> Me either. I can, of c

Re: pgsql: Change floating-point output format for improved performance.

2019-02-13 Thread Andrew Dunstan
On 2/13/19 12:01 PM, Andres Freund wrote: > Hi Andrew^2, > > On 2019-02-13 16:38:16 +, Andrew Gierth wrote: >> Cross-version upgrade is the big problem; I have no real idea how to >> make that test work short of adding another GUC; revert? > Andrew Dunstan might be able to help, although I'm

pgsql: Remove a stray subnormal value from float tests.

2019-02-13 Thread Andrew Gierth
Remove a stray subnormal value from float tests. We don't care to assume that input of subnormal float values works, but a stray subnormal value from the upstream Ryu regression test had been left in the test data by mistake. Remove it. Per buildfarm member fulmar. Branch -- master Details

pgsql: Add -mpopcnt to all compiles of pg_bitutils.c

2019-02-13 Thread Alvaro Herrera
Add -mpopcnt to all compiles of pg_bitutils.c The way this makefile works, we need to specify it three times. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d0b4663c23b7a6ae6f489c4d7a2f58f879914959 Modified Files -- src/port/Makefile | 2 ++ 1 file chan

pgsql: More float test and portability fixes.

2019-02-13 Thread Andrew Gierth
More float test and portability fixes. Avoid assuming exact results in tstypes test; some platforms vary. (per buildfarm members eulachon, danio, lapwing) Avoid dubious usage (inherited from upstream) of bool parameters to copy_special_str, to see if this fixes the mac/ppc failures (per buildfarm

pgsql: Add basic support for using the POPCNT and SSE4.2s LZCNT opcodes

2019-02-13 Thread Alvaro Herrera
Add basic support for using the POPCNT and SSE4.2s LZCNT opcodes These opcodes have been around in the AMD world since 2007, and 2008 in the case of intel. They're supported in GCC and Clang via some __builtin macros. The opcodes may be unavailable during runtime, in which case we fall back on a

Re: pgsql: Change floating-point output format for improved performance.

2019-02-13 Thread Andres Freund
Hi Andrew^2, On 2019-02-13 16:38:16 +, Andrew Gierth wrote: > Cross-version upgrade is the big problem; I have no real idea how to > make that test work short of adding another GUC; revert? Andrew Dunstan might be able to help, although I'm not immediately sure how... Greetings, Andres Freu

Re: pgsql: Change floating-point output format for improved performance.

2019-02-13 Thread Andrew Gierth
> "Andrew" == Andrew Gierth writes: Fallout so far: Cygwin claims to have strtof, but it silently underflows to zero and misrounds input. Could be fixable with a variant output file? ICC seems to be miscompiling something, that'll need investigation. s390 failures: ts_rank isn't as numeric

pgsql: Fix an overlooked UINT32_MAX.

2019-02-13 Thread Andrew Gierth
Fix an overlooked UINT32_MAX. Replace with PG_UINT32_MAX. Per buildfarm members dory and woodlouse. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/754ca99314e9e1debe855b0462869ef6e58b7e7a Modified Files -- src/common/f2s.c | 2 +- 1 file changed, 1 inse

Re: pgsql: Change floating-point output format for improved performance.

2019-02-13 Thread Andrew Gierth
Already aware of the windows breakage, will fix in a sec. -- Andrew (irc:RhodiumToad)

pgsql: Change floating-point output format for improved performance.

2019-02-13 Thread Andrew Gierth
Change floating-point output format for improved performance. Previously, floating-point output was done by rounding to a specific decimal precision; by default, to 6 or 15 decimal digits (losing information) or as requested using extra_float_digits. Drivers that wanted exact float values, and app

pgsql: Use strtof() and not strtod() for float4 input.

2019-02-13 Thread Andrew Gierth
Use strtof() and not strtod() for float4 input. Using strtod() creates a double-rounding problem; the input decimal value is first rounded to the nearest double; rounding that to the nearest float may then give an incorrect result. An example is that 7.038531e-26 when input via strtod and then ro

pgsql: Remove useless casts

2019-02-13 Thread Peter Eisentraut
Remove useless casts Some of these were uselessly casting away "const", some were just nearby, but they where all unnecessary anyway. Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com Branch -- master Details --- https://git.p

pgsql: More unconstify use

2019-02-13 Thread Peter Eisentraut
More unconstify use Replace casts whose only purpose is to cast away const with the unconstify() macro. Discussion: https://www.postgresql.org/message-id/flat/53a28052-f9f3-1808-fed9-460fd43035ab%402ndquadrant.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/37